From: mansankar Date: Mon, 18 Feb 2019 09:36:15 +0000 (+0530) Subject: [ITC][watchface-complication][Non-ACR][Change ITC package name of watchface to watchf... X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ead044d7145e44935a8e5c15e9768236842077df;p=test%2Ftct%2Fnative%2Fapi.git [ITC][watchface-complication][Non-ACR][Change ITC package name of watchface to watchface-complication] Change-Id: I2dde973c31af4a596cc1d5a26841cc8edab7a262 Signed-off-by: mansankar --- diff --git a/packaging/itc/native-watchface-complication-itc.spec b/packaging/itc/native-watchface-complication-itc.spec new file mode 100644 index 000000000..d49c1e060 --- /dev/null +++ b/packaging/itc/native-watchface-complication-itc.spec @@ -0,0 +1,85 @@ +%define MODULE_NAME watchface-complication +%define MODULE_LIBNAME watchface-complication +Name: native-%{MODULE_NAME}-itc +Summary: Native API Integration TC (%{name}) +Version: 0.1 +Release: 0 +Group: Development/Tools +License: Apache-2.0 +Source0: %{name}-%{version}.tar.gz +BuildRequires: pkgconfig(%{MODULE_LIBNAME}) +BuildRequires: pkgconfig(capi-appfw-application) +BuildRequires: pkgconfig(elementary) +BuildRequires: pkgconfig(dlog) +BuildRequires: pkgconfig(glib-2.0) +BuildRequires: cmake +BuildRequires: pkgconfig(bundle) +BuildRequires: pkgconfig(capi-system-info) +BuildRequires: pkgconfig(capi-media-sound-manager) + +%description +Native API Integration 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="itc" -DDEVICE_BUILD_TYPE="mobile" -DASANBUILD="true" -DCMAKE_INSTALL_PREFIX=%{_prefix} + %endif + %if %{?DEVICE_BUILD_TYPE_WEARABLE:1}0 + cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="itc" -DDEVICE_BUILD_TYPE="wearable" -DASANBUILD="true" -DCMAKE_INSTALL_PREFIX=%{_prefix} + %endif + %if %{?DEVICE_BUILD_TYPE_TV:1}0 + cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="itc" -DDEVICE_BUILD_TYPE="tv" -DASANBUILD="true" -DCMAKE_INSTALL_PREFIX=%{_prefix} + %endif + %if %{?DEVICE_BUILD_TYPE_TIZENIOT:1}0 + cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="itc" -DDEVICE_BUILD_TYPE="tizeniot" -DASANBUILD="true" -DCMAKE_INSTALL_PREFIX=%{_prefix} + %endif +%else + %if %{?DEVICE_BUILD_TYPE_MOBILE:1}0 + cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="itc" -DDEVICE_BUILD_TYPE="mobile" -DASANBUILD="false" -DCMAKE_INSTALL_PREFIX=%{_prefix} + %endif + %if %{?DEVICE_BUILD_TYPE_WEARABLE:1}0 + cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="itc" -DDEVICE_BUILD_TYPE="wearable" -DASANBUILD="false" -DCMAKE_INSTALL_PREFIX=%{_prefix} + %endif + %if %{?DEVICE_BUILD_TYPE_TV:1}0 + cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="itc" -DDEVICE_BUILD_TYPE="tv" -DASANBUILD="false" -DCMAKE_INSTALL_PREFIX=%{_prefix} + %endif + %if %{?DEVICE_BUILD_TYPE_TIZENIOT:1}0 + cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="itc" -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}%{APP_PATH}%{name}/data/ +mkdir -p %{buildroot}/usr/share/packages/ +cp packaging/itc/native-%{MODULE_NAME}-itc.xml %{buildroot}/usr/share/packages/ +mkdir -p %{buildroot}%{APP_PATH}%{name}/bin +mkdir -p %{buildroot}%{APP_PATH}%{name}/res +cp -r src/itc/watchface-complication/res/* %{buildroot}%{APP_PATH}%{name}/res +#cp templates/external_wrapper.sh %{buildroot}%{APP_PATH}%{name}/bin +%post +chown -R 5000:5000 %{APP_PATH}%{name}/data +chsmack -a %{name} %{APP_PATH}%{name}/data +%postun + + +%files +%{APP_PATH}%{name}/* +/usr/share/packages/native-%{MODULE_NAME}-itc.xml +/usr/share/license/%{name} + diff --git a/packaging/itc/native-watchface-complication-itc.xml b/packaging/itc/native-watchface-complication-itc.xml new file mode 100644 index 000000000..4f3e68091 --- /dev/null +++ b/packaging/itc/native-watchface-complication-itc.xml @@ -0,0 +1,56 @@ + + + + test + Native API test Application + + + + + 10 + + + 10 + + + 10 + 100 + 30 + + + iconicon + + + imageimage + + + 10 + 20 + 15 + + + 60 + + tap + + + + + + + + + + + + + + + + + http://tizen.org/privilege/appmanager.launch + http://tizen.org/privilege/datasharing + http://tizen.org/privilege/packagemanager.info + + + diff --git a/packaging/itc/native-watchface-itc.spec b/packaging/itc/native-watchface-itc.spec deleted file mode 100644 index d0c680ccf..000000000 --- a/packaging/itc/native-watchface-itc.spec +++ /dev/null @@ -1,85 +0,0 @@ -%define MODULE_NAME watchface -%define MODULE_LIBNAME watchface -Name: native-%{MODULE_NAME}-itc -Summary: Native API Integration TC (%{name}) -Version: 0.1 -Release: 0 -Group: Development/Tools -License: Apache-2.0 -Source0: %{name}-%{version}.tar.gz -BuildRequires: pkgconfig(%{MODULE_LIBNAME}) -BuildRequires: pkgconfig(capi-appfw-application) -BuildRequires: pkgconfig(elementary) -BuildRequires: pkgconfig(dlog) -BuildRequires: pkgconfig(glib-2.0) -BuildRequires: cmake -BuildRequires: pkgconfig(bundle) -BuildRequires: pkgconfig(capi-system-info) -BuildRequires: pkgconfig(capi-media-sound-manager) - -%description -Native API Integration 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="itc" -DDEVICE_BUILD_TYPE="mobile" -DASANBUILD="true" -DCMAKE_INSTALL_PREFIX=%{_prefix} - %endif - %if %{?DEVICE_BUILD_TYPE_WEARABLE:1}0 - cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="itc" -DDEVICE_BUILD_TYPE="wearable" -DASANBUILD="true" -DCMAKE_INSTALL_PREFIX=%{_prefix} - %endif - %if %{?DEVICE_BUILD_TYPE_TV:1}0 - cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="itc" -DDEVICE_BUILD_TYPE="tv" -DASANBUILD="true" -DCMAKE_INSTALL_PREFIX=%{_prefix} - %endif - %if %{?DEVICE_BUILD_TYPE_TIZENIOT:1}0 - cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="itc" -DDEVICE_BUILD_TYPE="tizeniot" -DASANBUILD="true" -DCMAKE_INSTALL_PREFIX=%{_prefix} - %endif -%else - %if %{?DEVICE_BUILD_TYPE_MOBILE:1}0 - cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="itc" -DDEVICE_BUILD_TYPE="mobile" -DASANBUILD="false" -DCMAKE_INSTALL_PREFIX=%{_prefix} - %endif - %if %{?DEVICE_BUILD_TYPE_WEARABLE:1}0 - cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="itc" -DDEVICE_BUILD_TYPE="wearable" -DASANBUILD="false" -DCMAKE_INSTALL_PREFIX=%{_prefix} - %endif - %if %{?DEVICE_BUILD_TYPE_TV:1}0 - cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="itc" -DDEVICE_BUILD_TYPE="tv" -DASANBUILD="false" -DCMAKE_INSTALL_PREFIX=%{_prefix} - %endif - %if %{?DEVICE_BUILD_TYPE_TIZENIOT:1}0 - cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="itc" -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}%{APP_PATH}%{name}/data/ -mkdir -p %{buildroot}/usr/share/packages/ -cp packaging/itc/native-%{MODULE_NAME}-itc.xml %{buildroot}/usr/share/packages/ -mkdir -p %{buildroot}%{APP_PATH}%{name}/bin -mkdir -p %{buildroot}%{APP_PATH}%{name}/res -cp -r src/itc/watchface/res/* %{buildroot}%{APP_PATH}%{name}/res -#cp templates/external_wrapper.sh %{buildroot}%{APP_PATH}%{name}/bin -%post -chown -R 5000:5000 %{APP_PATH}%{name}/data -chsmack -a %{name} %{APP_PATH}%{name}/data -%postun - - -%files -%{APP_PATH}%{name}/* -/usr/share/packages/native-%{MODULE_NAME}-itc.xml -/usr/share/license/%{name} - diff --git a/packaging/itc/native-watchface-itc.xml b/packaging/itc/native-watchface-itc.xml deleted file mode 100644 index 6e3582e8b..000000000 --- a/packaging/itc/native-watchface-itc.xml +++ /dev/null @@ -1,56 +0,0 @@ - - - - test - Native API test Application - - - - - 10 - - - 10 - - - 10 - 100 - 30 - - - iconicon - - - imageimage - - - 10 - 20 - 15 - - - 60 - - tap - - - - - - - - - - - - - - - - - http://tizen.org/privilege/appmanager.launch - http://tizen.org/privilege/datasharing - http://tizen.org/privilege/packagemanager.info - - - diff --git a/src/itc/watchface-complication/CMakeLists.txt b/src/itc/watchface-complication/CMakeLists.txt new file mode 100644 index 000000000..e5b5937ca --- /dev/null +++ b/src/itc/watchface-complication/CMakeLists.txt @@ -0,0 +1,42 @@ +SET(PKG_NAME "watchface-complication") + +SET(EXEC_NAME "tct-${PKG_NAME}-native") +SET(RPM_NAME "native-${PKG_NAME}-itc") + +SET(CAPI_LIB "watchface-complication") +SET(TC_SOURCES + ITs-watchface-common.c + ITs-watchface-complication.c + ITs-watchface-editable.c + ITs-watchface-complication-provider.c +) + +PKG_CHECK_MODULES(${CAPI_LIB} REQUIRED + ${CAPI_LIB} + capi-appfw-application + libsystemd-journal + bundle + glib-2.0 + capi-system-info +) + +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/itc/watchface-complication/ITs-watchface-common.c b/src/itc/watchface-complication/ITs-watchface-common.c new file mode 100644 index 000000000..7e01a2f8b --- /dev/null +++ b/src/itc/watchface-complication/ITs-watchface-common.c @@ -0,0 +1,134 @@ +// +// Copyright (c) 2019 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 "ITs-watchface-common.h" + +/** @addtogroup itc-watchface +* @ingroup itc +* @{ +*/ + +/** +* @function WatchfaceComplicationGetError +* @description Maps error enums to string values for watchface +* @parameter nRet : error code returned +* @return error string +*/ +char* WatchfaceComplicationGetError(int nRet) +{ + char *szErrorVal = NULL; + switch( nRet ) + { + + case WATCHFACE_COMPLICATION_ERROR_NONE: szErrorVal = "TIZEN_ERROR_NONE"; break; + case WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY: szErrorVal = "TIZEN_ERROR_OUT_OF_MEMORY"; break; + case WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER: szErrorVal = "TIZEN_ERROR_INVALID_PARAMETER"; break; + case WATCHFACE_COMPLICATION_ERROR_IO_ERROR: szErrorVal = "TIZEN_ERROR_IO_ERROR"; break; + case WATCHFACE_COMPLICATION_ERROR_NO_DATA: szErrorVal = "TIZEN_ERROR_NO_DATA"; break; + case WATCHFACE_COMPLICATION_ERROR_PERMISSION_DENIED: szErrorVal = "TIZEN_ERROR_PERMISSION_DENIED"; break; + case WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED: szErrorVal = "TIZEN_ERROR_NOT_SUPPORTED"; break; + case WATCHFACE_COMPLICATION_ERROR_DB: szErrorVal = "TIZEN_ERROR_COMPLICATION | 0x1"; break; + case WATCHFACE_COMPLICATION_ERROR_DBUS: szErrorVal = "TIZEN_ERROR_COMPLICATION | 0x2"; break; + case WATCHFACE_COMPLICATION_ERROR_EDIT_NOT_READY: szErrorVal = "TIZEN_ERROR_COMPLICATION | 0x3"; break; + case WATCHFACE_COMPLICATION_ERROR_EXIST_ID: szErrorVal = "TIZEN_ERROR_COMPLICATION | 0x4"; break; + case WATCHFACE_COMPLICATION_ERROR_NOT_EXIST: szErrorVal = "TIZEN_ERROR_COMPLICATION | 0x5"; break; + case WATCHFACE_COMPLICATION_ERROR_PROVIDER_NOT_AVAILABLE: szErrorVal = "TIZEN_ERROR_COMPLICATION"; break; + } + return szErrorVal; +} + +/** +* @function AppControlGetError +* @description Maps error enums to string values +* @parameter nRet : error code returned +* @return error string +*/ +char* AppControlGetError(int nRet) +{ + char *szErrorVal = NULL; + switch ( nRet ) + { + case APP_CONTROL_ERROR_NONE: szErrorVal = "APP_CONTROL_ERROR_NONE";break; + case APP_CONTROL_ERROR_INVALID_PARAMETER: szErrorVal = "APP_CONTROL_ERROR_INVALID_PARAMETER";break; + case APP_CONTROL_ERROR_OUT_OF_MEMORY: szErrorVal = "APP_CONTROL_ERROR_OUT_OF_MEMORY";break; + case APP_CONTROL_ERROR_APP_NOT_FOUND: szErrorVal = "APP_CONTROL_ERROR_APP_NOT_FOUND";break; + case APP_CONTROL_ERROR_KEY_NOT_FOUND: szErrorVal = "APP_CONTROL_ERROR_KEY_NOT_FOUND";break; + case APP_CONTROL_ERROR_KEY_REJECTED: szErrorVal = "APP_CONTROL_ERROR_KEY_REJECTED";break; + case APP_CONTROL_ERROR_INVALID_DATA_TYPE: szErrorVal = "APP_CONTROL_ERROR_INVALID_DATA_TYPE";break; + case APP_CONTROL_ERROR_LAUNCH_REJECTED: szErrorVal = "APP_CONTROL_ERROR_LAUNCH_REJECTED";break; + case APP_CONTROL_ERROR_PERMISSION_DENIED: szErrorVal = "APP_CONTROL_ERROR_PERMISSION_DENIED";break; + case APP_CONTROL_ERROR_LAUNCH_FAILED: szErrorVal = "APP_CONTROL_ERROR_LAUNCH_FAILED";break; + case APP_CONTROL_ERROR_TIMED_OUT: szErrorVal = "APP_CONTROL_ERROR_TIMED_OUT";break; + default: szErrorVal = "Undefined Error";break; + } + return szErrorVal; +} + +/** +* @function BundleGetError +* @description Maps error enums to string values +* @parameter nRet : error code returned +* @return error string +*/ +char* BundleGetError(int nRet) +{ + char *szErrorVal = NULL; + switch ( nRet ) + { + case BUNDLE_ERROR_NONE: szErrorVal = "BUNDLE_ERROR_NONE"; break; + case BUNDLE_ERROR_OUT_OF_MEMORY: szErrorVal = "BUNDLE_ERROR_OUT_OF_MEMORY"; break; + case BUNDLE_ERROR_INVALID_PARAMETER: szErrorVal = "BUNDLE_ERROR_INVALID_PARAMETER"; break; + case BUNDLE_ERROR_KEY_NOT_AVAILABLE: szErrorVal = "BUNDLE_ERROR_KEY_NOT_AVAILABLE"; break; + case BUNDLE_ERROR_KEY_EXISTS: szErrorVal = "BUNDLE_ERROR_KEY_EXISTS"; break; + default: szErrorVal = "Unknown Error"; break; + } + return szErrorVal; +} + +/** + * @function TimeoutFunction + * @description Called if some callback is not invoked for a particular timeout + * @parameter gpointer data + * @return gboolean + */ +gboolean TimeoutFunction(gpointer data) +{ + GMainLoop *pMainLoop = NULL; + pMainLoop = (GMainLoop *)data; + if ( pMainLoop != NULL ) + { + g_main_loop_quit(pMainLoop); + } + return false; +} + +/** +* @function IterateGmainLoop +* @description Called to wait +* @parameter NA +* @return NA +*/ +void IterateGmainLoop(void) +{ + if(g_bCallBackHit != true) + { + g_pMainLoop = g_main_loop_new(NULL, false); + g_nTimeoutId = g_timeout_add(TIMEOUT_CB, TimeoutFunction, g_pMainLoop); + g_main_loop_run(g_pMainLoop); + g_source_remove(g_nTimeoutId); + g_nTimeoutId = 0; + g_pMainLoop = NULL; + } +} diff --git a/src/itc/watchface-complication/ITs-watchface-common.h b/src/itc/watchface-complication/ITs-watchface-common.h new file mode 100644 index 000000000..afbb157c5 --- /dev/null +++ b/src/itc/watchface-complication/ITs-watchface-common.h @@ -0,0 +1,262 @@ +// +// Copyright (c) 2019 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 _ITS_WATCHFACE_COMMON_H_ +#define _ITS_WATCHFACE_COMMON_H_ + +//Add test package related includes here +#include +#include +#include +#include +#include + +#include "tct_common.h" +#include +#include + +/** @addtogroup itc-watchface +* @ingroup itc +* @{ +*/ + +bool g_bWatchfaceCreation; +GMainLoop *g_pMainLoop; +int g_nTimeoutId; +bool g_bCallBackHit; +bool g_bCheckerHit; +bool g_bWatchApp; +bool g_bFeatureNotSupported; +bool g_bIsFeatureMismatched; +app_control_h g_hTestControl; +char *g_pszEditableGetName; +char *g_pszEventCmd; +static char g_pszCheckUserData[] = "check_user_data"; + +#define pszEditableSetName "TEST" +#define API_NAMESPACE "WATCHFACE_ITC" +#define MAXENUMSIZE 50 +#define SETENUM 1 +#define GETENUM 0 +#define FEATURE_WATCH_APP "http://tizen.org/feature/watch_app" +#define TIMEOUT_CB 25000 + +#define SETUP_IS_EDITING_TEST_VAL "SETUP_IS_EDITING_TEST_VAL" +#define SETUP_REPLY_TO_EDITOR_TEST_VAL "SETUP_REPLY_TO_EDITOR_TEST_VAL" +#define SETUP_GET_CONTEXT_TEST_VAL "SETUP_GET_CONTEXT_VAL" + +#define EVENT_GET_PROVIDER_ID_TEST_VAL "EVENT_GET_PROVIDER_ID_TEST_VAL" +#define EVENT_GET_COMP_TYPE_TEST_VAL "EVENT_GET_COMP_TYPE_TEST_VAL" +#define EVENT_GET_CONTEXT_TEST_VAL "EVENT_GET_CONTEXT_TEST_VAL" +#define EVENT_GET_EVENT_TYPE_TEST_VAL "EVENT_GET_EVENT_TYPE_TEST_VAL" + + +#define START_TEST {\ + FPRINTF("[Line : %d][%s] Starting test : %s\\n", __LINE__, API_NAMESPACE, __FUNCTION__);\ +} + +#define CALLBACK_EXIT(eCompare, eRetVal, API, Error) {\ + if ( eRetVal == eCompare )\ +{\ + if ( DEBUG )\ +{\ + FPRINTF("[Line : %d][%s] %s passed\\n", __LINE__, API_NAMESPACE, API);\ +}\ +}\ + else \ +{\ + FPRINTF("[Line : %d][%s] %s failed, error returned = %s [%d]\\n", __LINE__, API_NAMESPACE, API, Error, eRetVal);\ + service_app_exit(); \ + return;\ +}\ +} + +#define CALLBACK_EXIT_CLEANUP(eCompare, eRetVal, API, Error, FreeResource) {\ + if ( eRetVal == eCompare )\ +{\ + if ( DEBUG )\ +{\ + FPRINTF("[Line : %d][%s] %s passed\\n", __LINE__, API_NAMESPACE, API);\ +}\ +}\ + else \ +{\ + FPRINTF("[Line : %d][%s] %s failed, error returned = %s [%d]\\n", __LINE__, API_NAMESPACE, API, Error, eRetVal);\ + FreeResource;\ + service_app_exit(); \ + return;\ +}\ +} + +#define CALLBACK_CHECK_HANDLE_EXIT(Handle, API) {\ + if ( Handle == NULL )\ +{\ + FPRINTF("[Line : %d][%s] %s failed, error returned = Handle returned is NULL\\n", __LINE__, API_NAMESPACE, API);\ + service_app_exit(); \ + return;\ +}\ +} + +#define CALLBACK_CHECK_HANDLE_EXIT_CLEANUP(Handle, API, FreeResource) {\ + if ( Handle == NULL )\ +{\ + FPRINTF("[Line : %d][%s] %s failed, error returned = Handle returned is NULL\\n", __LINE__, API_NAMESPACE, API);\ + FreeResource;\ + service_app_exit(); \ + return;\ +}\ +} + +#define CHECK_HANDLE(Handle, API) {\ + if ( Handle == NULL )\ +{\ + FPRINTF("[Line : %d][%s] %s failed, error returned = Handle returned is NULL\\n", __LINE__, API_NAMESPACE, API);\ + return 1;\ +}\ +} + +#define CHECK_HANDLE_EXIT(Handle, API) {\ + if ( Handle == NULL )\ +{\ + FPRINTF("[Line : %d][%s] %s failed, error returned = Handle returned is NULL\\n", __LINE__, API_NAMESPACE, API);\ + service_app_exit(); \ + return 1;\ +}\ +} + +#define CHECK_HANDLE_CLEANUP(Handle, API, FreeResource) {\ + if ( Handle == NULL )\ +{\ + FPRINTF("[Line : %d][%s] %s failed, error returned = Handle returned is NULL\\n", __LINE__, API_NAMESPACE, API);\ + FreeResource;\ + return 1;\ +}\ +} + +#define CHECK_HANDLE_EXIT_CLEANUP(Handle, API, FreeResource) {\ + if ( Handle == NULL )\ +{\ + FPRINTF("[Line : %d][%s] %s failed, error returned = Handle returned is NULL\\n", __LINE__, API_NAMESPACE, API);\ + FreeResource;\ + service_app_exit(); \ + return 1;\ +}\ +} + +#define PRINT_RESULT_EXIT(eCompare, eRetVal, API, Error) {\ + if ( eRetVal == eCompare )\ +{\ + if ( DEBUG )\ +{\ + FPRINTF("[Line : %d][%s] %s passed\\n", __LINE__, API_NAMESPACE, API);\ +}\ +}\ + else \ +{\ + FPRINTF("[Line : %d][%s] %s failed, error returned = %s [%d]\\n", __LINE__, API_NAMESPACE, API, Error, eRetVal);\ + service_app_exit(); \ + return 1;\ +}\ +} + +#define PRINT_RESULT_EXIT_NORETURN(eCompare, eRetVal, API, Error) {\ + if ( eRetVal == eCompare )\ +{\ + if ( DEBUG )\ +{\ + FPRINTF("[Line : %d][%s] %s passed\\n", __LINE__, API_NAMESPACE, API);\ +}\ +}\ + else \ +{\ + FPRINTF("[Line : %d][%s] %s failed, error returned = %s [%d]\\n", __LINE__, API_NAMESPACE, API, Error, eRetVal);\ + service_app_exit(); \ + return;\ +}\ +} + +#define PRINT_RESULT_EXIT_CLEANUP(eCompare, eRetVal, API, Error, FreeResource) {\ + if ( eRetVal == eCompare )\ +{\ + if ( DEBUG )\ +{\ + FPRINTF("[Line : %d][%s] %s passed\\n", __LINE__, API_NAMESPACE, API);\ +}\ +}\ +else \ +{\ + FPRINTF("[Line : %d][%s] %s failed, error returned = %s [%d]\\n", __LINE__, API_NAMESPACE, API, Error, eRetVal);\ + FreeResource;\ + service_app_exit(); \ + return 1;\ +}\ +} + +#define ISFEATURE_SUPPORTED_EXIT(eCompare, eRetVal, API) {\ + if ( !g_bWatchApp )\ +{\ + if ( eCompare == eRetVal )\ +{\ + FPRINTF("[Line:%d][%s] FeatureWatchApp not supported\\n", __LINE__, API_NAMESPACE);\ + g_bFeatureNotSupported = true;\ + service_app_exit();\ + return 0;\ +}\ + else \ +{\ + g_bIsFeatureMismatched = true;\ + FPRINTF("[Line : %d][%s] %s failed due to feature mismatch.\\n", __LINE__, API_NAMESPACE, API);\ + service_app_exit(); \ + return 1;\ +}\ +}\ +} + +#define CALLBACK_ISFEATURE_SUPPORTED_EXIT(eCompare, eRetVal, API) {\ + if ( !g_bWatchApp )\ +{\ + if ( eCompare == eRetVal )\ +{\ + FPRINTF("[Line:%d][%s] FeatureWatchApp not supported\\n", __LINE__, API_NAMESPACE);\ + g_bFeatureNotSupported = true;\ + service_app_exit();\ + return;\ +}\ + else \ +{\ + g_bIsFeatureMismatched = true;\ + FPRINTF("[Line : %d][%s] %s failed due to feature mismatch.\\n", __LINE__, API_NAMESPACE, API);\ + service_app_exit(); \ + return;\ +}\ +}\ +} + +char* WatchfaceComplicationGetError(int nRet); +char* AppControlGetError(int nRet); +char* BundleGetError(int nRet); +gboolean TimeoutFunction(gpointer data); +void IterateGmainLoop(void); +extern void WatchfaceComplicationProviderSetupGetContextChecker(void); +extern void WatchfaceComplicationProviderSetupReplyToEditorChecker(void); +extern void WatchfaceComplicationProviderSetupIsEditingChecker(void); +extern void WatchfaceComplicationProviderEventGetTypeChecker(void); +extern void WatchfaceComplicationProviderEventGetProviderIdChecker(void); +extern void WatchfaceComplicationProviderEventGetComplicationTypeChecker(void); +extern void WatchfaceComplicationProviderEventGetContextChecker(void); + + +/** @} */ +#endif //_ITS_watchface_COMMON_H_ diff --git a/src/itc/watchface-complication/ITs-watchface-complication-provider.c b/src/itc/watchface-complication/ITs-watchface-complication-provider.c new file mode 100755 index 000000000..8bf99b53c --- /dev/null +++ b/src/itc/watchface-complication/ITs-watchface-complication-provider.c @@ -0,0 +1,1292 @@ +// +// Copyright (c) 2019 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 +#include +#include +#include +#include +#include "ITs-watchface-common.h" +#define TEST_PROVIDER_ID "org.tizen.watchface_sample_provider/test" +#define PROVIDER_ID "org.tizen.watchface-complication-native-itc/test" +#define EDITOR_CMD_KEY "EDITOR_CMD" +#define EDITOR_ID "org.tizen.watchface_sample_editor" +#define WATCHFACE_ID "org.tizen.watchface_sample" +#define COMPLICATION_TEST_APP "org.tizen.complication_test" +#define MAX_COUNTER 5 +#define DATAISVALIDID 2 +static int nWatchfaceId = 0; + +/** @addtogroup itc-watchface +* @ingroup itc +* @{ +*/ + + +//& set: watchface + +/** +* @function ITs_watchface_complication_provider_startup +* @description Called before each test, set the service boolean true +* @parameter NA +* @nReturn NA +*/ +void ITs_watchface_complication_provider_startup(void) +{ +#if DEBUG + FPRINTF("[Line : %d][%s] TEST SUIT start-up: ITs_Watchface_Complication_Provider_p\\n", __LINE__, API_NAMESPACE); +#endif + g_bWatchApp = TCTCheckSystemInfoFeatureSupported(FEATURE_WATCH_APP, API_NAMESPACE); + g_bFeatureNotSupported = false; + g_bIsFeatureMismatched = false; + return; +} + +/** +* @function ITs_watchface_complication_provider_cleanup +* @description Called after each test +* @parameter NA +* @nReturn NA +*/ +void ITs_watchface_complication_provider_cleanup(void) +{ +#if DEBUG + FPRINTF("[Line : %d][%s] TEST SUIT clean-up: ITs_Watchface_Complication_Provider_p\\n", __LINE__, API_NAMESPACE); +#endif + return; +} + +/****************************************************Helper Functions Start****************************************************/ +/** +* @function RunApp +* @description Helper Function +* @parameters char *pszTargetApp, char *pszKey, char *pszValue, int nCompId +* @return NA +*/ +static void RunApp(char *pszTargetApp, char *pszKey, char *pszValue, int nCompId) +{ + FPRINTF("[Line : %d][%s] entered %s.\\n", __LINE__, API_NAMESPACE, "RunApp"); + static app_control_h hAppControl; + bool bIsRunning = false; + char pszCompId[10]; + int nCounter = MAX_COUNTER; + + int nRet = app_control_create(&hAppControl); + if(nRet != APP_CONTROL_ERROR_NONE) + { + FPRINTF("[Line : %d][%s] app_control_create returned %s error\\n", __LINE__, API_NAMESPACE, AppControlGetError(nRet)); + return; + } + if(hAppControl == NULL) + { + FPRINTF("[Line : %d][%s] %s failed, error returned = Handle returned is NULL\\n", __LINE__, API_NAMESPACE, "app_control_create"); + return; + } + + nRet = app_control_set_app_id(hAppControl, pszTargetApp); + if(nRet != APP_CONTROL_ERROR_NONE) + { + FPRINTF("[Line : %d][%s] app_control_set_app_id returned %s error\\n", __LINE__, API_NAMESPACE, AppControlGetError(nRet)); + app_control_destroy(hAppControl); + return; + } + + if (pszKey && pszValue) { + nRet = app_control_add_extra_data(hAppControl, pszKey, pszValue); + if(nRet != APP_CONTROL_ERROR_NONE) + { + FPRINTF("[Line : %d][%s] app_control_add_extra_data returned %s error\\n", __LINE__, API_NAMESPACE, AppControlGetError(nRet)); + app_control_destroy(hAppControl); + return; + } + } + sprintf(pszCompId, "%d", nCompId); + nRet = app_control_add_extra_data(hAppControl, "COMP_ID", pszCompId); + if(nRet != APP_CONTROL_ERROR_NONE) + { + FPRINTF("[Line : %d][%s] app_control_add_extra_data returned %s error\\n", __LINE__, API_NAMESPACE, AppControlGetError(nRet)); + app_control_destroy(hAppControl); + return; + } + + nRet = app_control_add_extra_data(hAppControl, "SENDER_ID", "org.tizen.watchface-complication-native-itc"); + if(nRet != APP_CONTROL_ERROR_NONE) + { + FPRINTF("[Line : %d][%s] app_control_add_extra_data returned %s error\\n", __LINE__, API_NAMESPACE, AppControlGetError(nRet)); + app_control_destroy(hAppControl); + return; + } + + do { + nRet = app_control_send_launch_request(hAppControl, NULL, NULL); + if (nRet != APP_CONTROL_ERROR_NONE) + sleep(1); + app_manager_is_running(pszTargetApp, &bIsRunning); + } while (--nCounter > 0 && !bIsRunning); + sleep(1); + app_control_destroy(hAppControl); +} + +/** +* @function ComplicationProviderUpdateRequestedCb +* @description Callback Function +* @parameters const char *pszProviderId, const char *pszReqAppid, + watchface_complication_type_e eType, const bundle *pszContext,bundle *pszShareData, void *pszUserData +* @return NA +*/ +static void ComplicationProviderUpdateRequestedCb(const char *pszProviderId, const char *pszReqAppid, + watchface_complication_type_e eType, const bundle *pszContext,bundle *pszShareData, void *pszUserData) +{ + FPRINTF("[Line : %d][%s] %s invoked\\n", __LINE__, API_NAMESPACE, "ComplicationProviderUpdateRequestedCb"); + g_bCallBackHit = true; + return; +} + +/** +* @function UpdateRequestedCb +* @description Callback Function +* @parameters const watchface_editable_h hHandle, int nSelectedIdx, const watchface_editable_edit_state_e eState, void *pszUserData +* @return NA +*/ +static void UpdateRequestedCb(const watchface_editable_h hHandle, int nSelectedIdx, const watchface_editable_edit_state_e eState, void *pszUserData) +{ + FPRINTF("[Line : %d][%s] %s invoked\\n", __LINE__, API_NAMESPACE, "UpdateRequestedCb"); + g_bCallBackHit = true; + return; +} + +/** +* @function SetupOnEditReadyCb +* @description Callback Function +* @parameters watchface_editable_container_h hEdCon, const char *pszEditorAppid, void *pszUserData +* @return NA +*/ +static void SetupOnEditReadyCb(watchface_editable_container_h hEdCon, const char *pszEditorAppid, void *pszUserData) +{ + FPRINTF("[Line : %d][%s] %s invoked\\n", __LINE__, API_NAMESPACE, "SetupOnEditReadyCb"); + int nEditableId = 1; + complication_h hComp = NULL; + watchface_editable_highlight_h hHighlight = NULL; + + int nRet = watchface_editable_highlight_create(&hHighlight, WATCHFACE_EDITABLE_SHAPE_TYPE_CIRCLE); + CALLBACK_ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_editable_highlight_create"); + CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_highlight_create", WatchfaceComplicationGetError(nRet)); + CALLBACK_CHECK_HANDLE_EXIT(hHighlight, "watchface_editable_highlight_create"); + + nRet = watchface_editable_highlight_set_geometry(hHighlight, 100, 100, 30, 30); + CALLBACK_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_highlight_set_geometry", WatchfaceComplicationGetError(nRet), watchface_editable_highlight_destroy(hHighlight)); + + nRet = watchface_complication_create(1, TEST_PROVIDER_ID, + WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT, + WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT, + WATCHFACE_COMPLICATION_EVENT_NONE, &hComp); + CALLBACK_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_create", WatchfaceComplicationGetError(nRet), watchface_editable_highlight_destroy(hHighlight)); + CALLBACK_CHECK_HANDLE_EXIT_CLEANUP(hComp, "watchface_complication_create", watchface_editable_highlight_destroy(hHighlight)); + + nRet = watchface_editable_add_complication(hEdCon, nEditableId, hComp, hHighlight); + CALLBACK_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_highlight_create", WatchfaceComplicationGetError(nRet), watchface_editable_highlight_destroy(hHighlight);watchface_complication_destroy(hComp)); + + nRet = watchface_editable_request_edit(hEdCon, UpdateRequestedCb, NULL); + CALLBACK_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_request_edit", WatchfaceComplicationGetError(nRet), watchface_editable_highlight_destroy(hHighlight);watchface_complication_destroy(hComp)); + + watchface_editable_highlight_destroy(hHighlight); + watchface_complication_destroy(hComp); + service_app_exit(); + return; +} + +/** +* @function UpdateRequestedCb2 +* @description Callback Function +* @parameters const char *pszProviderId, const char *pszReqAppid, watchface_complication_type_e eType, const bundle *pszContext, + bundle *pszSharedData, void *pszUserData +* @return NA +*/ +static void UpdateRequestedCb2(const char *pszProviderId, const char *pszReqAppid, watchface_complication_type_e eType, const bundle *pszContext, + bundle *pszSharedData, void *pszUserData) +{ + FPRINTF("[Line : %d][%s] %s invoked\\n", __LINE__, API_NAMESPACE, "UpdateRequestedCb2"); + int nRet = WATCHFACE_COMPLICATION_ERROR_IO_ERROR; + switch(eType) + { + case WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT : + nRet = watchface_complication_provider_data_set_short_text(pszSharedData, "short text"); + CALLBACK_ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_provider_data_set_short_text"); + CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_data_set_short_text", WatchfaceComplicationGetError(nRet)); + nRet = watchface_complication_provider_data_set_title( pszSharedData, "title"); + CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_data_set_title", WatchfaceComplicationGetError(nRet)); + break; + case WATCHFACE_COMPLICATION_TYPE_LONG_TEXT : + nRet = watchface_complication_provider_data_set_long_text(pszSharedData, "long text"); + CALLBACK_ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_provider_data_set_long_text"); + CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_data_set_long_text", WatchfaceComplicationGetError(nRet)); + nRet = watchface_complication_provider_data_set_extra_data(pszSharedData, "extra data"); + CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_data_set_extra_data", WatchfaceComplicationGetError(nRet)); + break; + case WATCHFACE_COMPLICATION_TYPE_RANGED_VALUE : + nRet = watchface_complication_provider_data_set_ranged_value( + pszSharedData, 50.0, 0.0, 100.0); + CALLBACK_ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_provider_data_set_ranged_value"); + CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_data_set_ranged_value", WatchfaceComplicationGetError(nRet)); + break; + case WATCHFACE_COMPLICATION_TYPE_ICON : + nRet = watchface_complication_provider_data_set_icon_path(pszSharedData, "temp_icon_path"); + CALLBACK_ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_provider_data_set_icon_path"); + CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_data_set_icon_path", WatchfaceComplicationGetError(nRet)); + break; + case WATCHFACE_COMPLICATION_TYPE_IMAGE : + nRet = watchface_complication_provider_data_set_image_path(pszSharedData, "temp_image_path"); + CALLBACK_ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_provider_data_set_image_path"); + CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_data_set_image_path", WatchfaceComplicationGetError(nRet)); + break; + case WATCHFACE_COMPLICATION_TYPE_TIME : + nRet = watchface_complication_provider_data_set_timestamp(pszSharedData, 12345); + CALLBACK_ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_provider_data_set_timestamp"); + CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_data_set_timestamp", WatchfaceComplicationGetError(nRet)); + break; + default : + break; + } + g_bCallBackHit = true; + service_app_exit(); +} + +/** +* @function WatchfaceComplicationProviderDataIsValidCb +* @description Callback Function +* @parameters const char *pszProviderId, const char *pszReqAppid, watchface_complication_type_e eType, const bundle *pszContext, bundle *pszSharedData, void *pszUserData +* @return NA +*/ +static void WatchfaceComplicationProviderDataIsValidCb(const char *pszProviderId, const char *pszReqAppid, watchface_complication_type_e eType, const bundle *pszContext, bundle *pszSharedData, void *pszUserData) +{ + FPRINTF("[Line : %d][%s] %s invoked\\n", __LINE__, API_NAMESPACE, "WatchfaceComplicationProviderDataIsValidCb"); + bool bIsValid = false; + char *pszUserDataChar = (char *)pszUserData; + int nRet; + + if (eType == WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT) + { + nRet = watchface_complication_provider_data_set_short_text(pszSharedData, "short_text"); + CALLBACK_ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_provider_data_set_short_text"); + CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_data_set_short_text", WatchfaceComplicationGetError(nRet)); + + nRet = watchface_complication_provider_data_is_valid(pszSharedData, &bIsValid); + CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_data_is_valid", WatchfaceComplicationGetError(nRet)); + if(bIsValid != true) + { + FPRINTF("[Line : %d][%s] %s failed. bIsValid = false\\n", __LINE__, API_NAMESPACE, "watchface_complication_provider_data_is_valid"); + app_control_destroy(g_hTestControl); + service_app_exit(); + return; + } + + if(strncmp(pszUserDataChar, g_pszCheckUserData, strlen(g_pszCheckUserData)) != 0){ + app_control_destroy(g_hTestControl); + service_app_exit(); + return; + } + g_bCallBackHit = true; + } + app_control_destroy(g_hTestControl); + service_app_exit(); + return; +} + +/** +* @function WatchfaceComplicationProviderSetupReplyToEditorChecker +* @description Helper Function +* @parameters NA +* @return NA +*/ +void WatchfaceComplicationProviderSetupReplyToEditorChecker(void) +{ + bundle *pszContext = bundle_create(); + int nRet = get_last_result(); + PRINT_RESULT_EXIT(nRet, BUNDLE_ERROR_NONE, "bundle_create", BundleGetError(nRet)); + CALLBACK_CHECK_HANDLE_EXIT_CLEANUP(pszContext, "bundle_create", app_control_destroy(g_hTestControl)); + nRet = watchface_complication_provider_setup_reply_to_editor(g_hTestControl, pszContext); + CALLBACK_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_setup_reply_to_editor", WatchfaceComplicationGetError(nRet), bundle_free(pszContext);app_control_destroy(g_hTestControl)); + bundle_free(pszContext); + app_control_destroy(g_hTestControl); + service_app_exit(); + g_bCheckerHit = true; + return; +} + +/** +* @function WatchfaceComplicationProviderSetupIsEditingChecker +* @description Helper Function +* @parameters NA +* @return NA +*/ +void WatchfaceComplicationProviderSetupIsEditingChecker(void) +{ + bool IsEditing = false; + int nRet = watchface_complication_provider_setup_is_editing(g_hTestControl, &IsEditing); + CALLBACK_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_setup_is_editing", WatchfaceComplicationGetError(nRet), app_control_destroy(g_hTestControl)); + if(IsEditing != true) + { + FPRINTF("[Line : %d][%s] %s failed. IsEditing = false\\n", __LINE__, API_NAMESPACE, "watchface_complication_provider_setup_is_editing"); + app_control_destroy(g_hTestControl); + service_app_exit(); + return; + } + app_control_destroy(g_hTestControl); + service_app_exit(); + g_bCheckerHit = true; + return; +} + +/** +* @function WatchfaceComplicationProviderSetupGetContextChecker +* @description Helper Function +* @parameters NA +* @return NA +*/ +void WatchfaceComplicationProviderSetupGetContextChecker(void) +{ + bundle *pszContext = NULL; + int nRet = watchface_complication_provider_setup_get_context(g_hTestControl, &pszContext); + CALLBACK_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_setup_get_context", WatchfaceComplicationGetError(nRet), app_control_destroy(g_hTestControl)); + CALLBACK_CHECK_HANDLE_EXIT_CLEANUP(pszContext, "watchface_complication_provider_setup_get_context", app_control_destroy(g_hTestControl)); + bundle_free(pszContext); + app_control_destroy(g_hTestControl); + service_app_exit(); + g_bCheckerHit = true; + return; +} + +/** +* @function WatchfaceComplicationProviderEventGetTypeChecker +* @description Helper Function +* @parameters NA +* @return NA +*/ +void WatchfaceComplicationProviderEventGetTypeChecker(void) +{ + watchface_complication_event_type_e eEventType = WATCHFACE_COMPLICATION_EVENT_NONE; + int nRet = watchface_complication_provider_event_get_type(g_hTestControl, &eEventType); + CALLBACK_ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_provider_event_get_type"); + CALLBACK_EXIT_CLEANUP(eEventType, WATCHFACE_COMPLICATION_EVENT_TAP, "watchface_complication_provider_event_get_type", WatchfaceComplicationGetError(nRet), app_control_destroy(g_hTestControl)); + if(eEventType < WATCHFACE_COMPLICATION_EVENT_NONE || eEventType > WATCHFACE_COMPLICATION_EVENT_DOUBLE_TAP) + { + FPRINTF("[Line : %d][%s] %s failed. eType = %d\\n", __LINE__, API_NAMESPACE, "watchface_complication_provider_event_get_type", eEventType); + app_control_destroy(g_hTestControl); + service_app_exit(); + return; + } + + g_bCheckerHit = true; + app_control_destroy(g_hTestControl); + service_app_exit(); + return; +} + +/** +* @function WatchfaceComplicationProviderEventGetProviderIdChecker +* @description Helper Function +* @parameters NA +* @return NA +*/ +void WatchfaceComplicationProviderEventGetProviderIdChecker(void) +{ + char *pszProviderId = NULL; + + int nRet = watchface_complication_provider_event_get_provider_id(g_hTestControl, &pszProviderId); + CALLBACK_ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_provider_event_get_provider_id"); + CALLBACK_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_event_get_provider_id", WatchfaceComplicationGetError(nRet), app_control_destroy(g_hTestControl)); + CALLBACK_CHECK_HANDLE_EXIT_CLEANUP(pszProviderId, "watchface_complication_provider_event_get_provider_id", app_control_destroy(g_hTestControl)); + + g_bCheckerHit = true; + app_control_destroy(g_hTestControl); + FREE_MEMORY(pszProviderId); + service_app_exit(); +} + +/** +* @function WatchfaceComplicationProviderEventGetComplicationTypeChecker +* @description Helper Function +* @parameters NA +* @return NA +*/ +void WatchfaceComplicationProviderEventGetComplicationTypeChecker(void) +{ + watchface_complication_type_e eType; + + int nRet = watchface_complication_provider_event_get_complication_type(g_hTestControl, &eType); + CALLBACK_ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_provider_event_get_complication_type"); + CALLBACK_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_event_get_complication_type", WatchfaceComplicationGetError(nRet), app_control_destroy(g_hTestControl)); + if(eType < WATCHFACE_COMPLICATION_TYPE_NO_DATA || eType > WATCHFACE_COMPLICATION_TYPE_IMAGE) + { + FPRINTF("[Line : %d][%s] %s failed. eType = %d\\n", __LINE__, API_NAMESPACE, "watchface_complication_provider_event_complication_type", eType); + app_control_destroy(g_hTestControl); + service_app_exit(); + return; + } + g_bCheckerHit = true; + app_control_destroy(g_hTestControl); + service_app_exit(); +} + +/** +* @function WatchfaceComplicationProviderEventGetContextChecker +* @description Helper Function +* @parameters NA +* @return NA +*/ +void WatchfaceComplicationProviderEventGetContextChecker(void) +{ + watchface_complication_type_e eType; + + int nRet = watchface_complication_provider_event_get_complication_type(g_hTestControl, &eType); + CALLBACK_ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_provider_event_get_complication_type"); + CALLBACK_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_event_get_context", WatchfaceComplicationGetError(nRet), app_control_destroy(g_hTestControl)); + if(eType < WATCHFACE_COMPLICATION_TYPE_NO_DATA || eType > WATCHFACE_COMPLICATION_TYPE_IMAGE) + { + FPRINTF("[Line : %d][%s] %s failed. eType = %d\\n", __LINE__, API_NAMESPACE, "watchface_complication_provider_event_get_complication_type", eType); + app_control_destroy(g_hTestControl); + service_app_exit(); + return; + } + g_bCheckerHit = true; + app_control_destroy(g_hTestControl); + service_app_exit(); +} + +/*****************************************************Helper Functions End*****************************************************/ + +//& purpose: To add and remove the callback function to be executed when the update requested +//& type: auto +/** +* @testcase ITc_watchface_complication_provider_add_remove_update_requested_cb_p +* @since_tizen 5.0 +* @author SRID(karanam.s) +* @reviewer SRID(manoj.g2) +* @type auto +* @description Add and remove the callback function to be executed when the update requested. +* @scenario Add and remove the callback function to be executed when the update requested. +* @apicovered watchface_complication_provider_add_update_requested_cb, watchface_complication_provider_remove_update_requested_cb +* @passcase When add and remove requested cb returns 0 +* @failcase When either of add and remove requested cb returns 1 +* @precondition N/A +* @postcondition N/A +* */ +int ITc_watchface_complication_provider_add_remove_update_requested_cb_p(void) +{ + START_TEST; + int nRet = watchface_complication_provider_add_update_requested_cb(PROVIDER_ID, ComplicationProviderUpdateRequestedCb, NULL); + ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_provider_add_update_requested_cb"); + PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_add_update_requested_cb", WatchfaceComplicationGetError(nRet)); + + nRet = watchface_complication_provider_remove_update_requested_cb(PROVIDER_ID, ComplicationProviderUpdateRequestedCb); + PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_remove_update_requested_cb", WatchfaceComplicationGetError(nRet)); + + service_app_exit(); + return 0; +} + +//& purpose: To notify to the complication that there is an update +//& type: auto +/** +* @testcase ITc_watchface_complication_provider_notify_update_p +* @since_tizen 5.0 +* @author SRID(karanam.s) +* @reviewer SRID(manoj.g2) +* @type auto +* @description Notifys to the complication that there is an update. +* @scenario Complication automatically requests data when notify is received. +* @apicovered watchface_complication_provider_notify_update +* @passcase watchface_complication_provider_notify_update returns 0 +* @failcase watchface_complication_provider_notify_update returns 1 +* @precondition N/A +* @postcondition N/A +* */ +int ITc_watchface_complication_provider_notify_update_p(void) +{ + START_TEST; + g_bCallBackHit = false; + int nRet = watchface_complication_provider_add_update_requested_cb(PROVIDER_ID, ComplicationProviderUpdateRequestedCb, NULL); + ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_provider_add_update_requested_cb"); + PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_add_update_requested_cb", WatchfaceComplicationGetError(nRet)); + + nWatchfaceId = nWatchfaceId + 1; + RunApp(COMPLICATION_TEST_APP, "COMP_TYPE", "SHORT_TEXT", nWatchfaceId); + + nRet = watchface_complication_provider_notify_update(PROVIDER_ID); + PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_notify_update", WatchfaceComplicationGetError(nRet)); + + IterateGmainLoop(); + if(!g_bCallBackHit) + { + FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "ComplicationProviderUpdateRequestedCb"); + nRet = watchface_complication_provider_remove_update_requested_cb(PROVIDER_ID, ComplicationProviderUpdateRequestedCb); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_remove_update_requested_cb", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 1; + } + + nRet = watchface_complication_provider_remove_update_requested_cb(PROVIDER_ID, ComplicationProviderUpdateRequestedCb); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_remove_update_requested_cb", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 0; +} + +//& purpose: To send reply to the editor +//& type: auto +/** +* @testcase ITc_watchface_complication_provider_setup_reply_to_editor_p +* @since_tizen 5.0 +* @author SRID(karanam.s) +* @reviewer SRID(manoj.g2) +* @type auto +* @description Sends reply to the editor. +* @scenario Using this function, setup app can sends new context data to the editor +* @apicovered watchface_complication_provider_setup_reply_to_editor +* @passcase watchface_complication_provider_setup_reply_to_editor returns 0 +* @failcase watchface_complication_provider_setup_reply_to_editor returns 1 +* @precondition N/A +* @postcondition N/A +* */ +int ITc_watchface_complication_provider_setup_reply_to_editor_p(void) +{ + START_TEST; + g_bCallBackHit = false; + g_bCheckerHit = false; + + int nRet = watchface_editable_add_edit_ready_cb(SetupOnEditReadyCb, NULL); + if(g_bFeatureNotSupported) + return 0; + if(g_bIsFeatureMismatched) + return 1; + PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_add_edit_ready_cb", WatchfaceComplicationGetError(nRet)); + + nWatchfaceId++; + RunApp(EDITOR_ID, EDITOR_CMD_KEY, SETUP_REPLY_TO_EDITOR_TEST_VAL, nWatchfaceId); + + IterateGmainLoop(); + if(!g_bCheckerHit) + { + FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "WatchfaceComplicationProviderSetupReplyToEditorChecker"); + nRet = watchface_editable_remove_edit_ready_cb(SetupOnEditReadyCb); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 1; + } + if(!g_bCallBackHit) + { + FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "SetupOnEditReadyCb"); + nRet = watchface_editable_remove_edit_ready_cb(SetupOnEditReadyCb); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 1; + } + + nRet = watchface_editable_remove_edit_ready_cb(SetupOnEditReadyCb); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 0; +} + +//& purpose: To check whether watch app request editing or not +//& type: auto +/** +* @testcase ITc_watchface_complication_provider_setup_is_editing_p +* @since_tizen 5.0 +* @author SRID(karanam.s) +* @reviewer SRID(manoj.g2) +* @type auto +* @description Checks whether watch app request editing or not. +* @scenario Using this function, setup app can tell what kind of UI should be displayed. +* @apicovered watchface_complication_provider_setup_is_editing +* @passcase watchface_complication_provider_setup_is_editing returns 0 +* @failcase watchface_complication_provider_setup_is_editing returns 1 +* @precondition N/A +* @postcondition N/A +* */ +int ITc_watchface_complication_provider_setup_is_editing_p(void) +{ + START_TEST; + g_bCallBackHit = false; + g_bCheckerHit = false; + + int nRet = watchface_editable_add_edit_ready_cb(SetupOnEditReadyCb, NULL); + if(g_bFeatureNotSupported) + return 0; + if(g_bIsFeatureMismatched) + return 1; + PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_add_edit_ready_cb", WatchfaceComplicationGetError(nRet)); + + nWatchfaceId++; + RunApp(EDITOR_ID, EDITOR_CMD_KEY, SETUP_IS_EDITING_TEST_VAL, nWatchfaceId); + + IterateGmainLoop(); + if(!g_bCheckerHit) + { + FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "WatchfaceComplicationProviderSetupIsEditingChecker"); + nRet = watchface_editable_remove_edit_ready_cb(SetupOnEditReadyCb); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 1; + } + if(!g_bCallBackHit) + { + FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "SetupOnEditReadyCb"); + nRet = watchface_editable_remove_edit_ready_cb(SetupOnEditReadyCb); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 1; + } + nRet = watchface_editable_remove_edit_ready_cb(SetupOnEditReadyCb); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 0; +} + +//& purpose: To get provider app's setup context data +//& type: auto +/** +* @testcase ITc_watchface_complication_provider_setup_get_context_p +* @since_tizen 5.0 +* @author SRID(karanam.s) +* @reviewer SRID(manoj.g2) +* @type auto +* @description Gets provider app's setup context data. +* @scenario Context data will be passed to the complication provider application. +* @apicovered watchface_complication_provider_setup_get_context +* @passcase watchface_complication_provider_setup_get_context returns 0 +* @failcase watchface_complication_provider_setup_get_context returns 1 +* @precondition N/A +* @postcondition N/A +* */ +int ITc_watchface_complication_provider_setup_get_context_p(void) +{ + START_TEST; + g_bCallBackHit = false; + int nRet = watchface_editable_add_edit_ready_cb(SetupOnEditReadyCb, NULL); + if(g_bFeatureNotSupported) + return 0; + if(g_bIsFeatureMismatched) + return 1; + PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_add_edit_ready_cb", WatchfaceComplicationGetError(nRet)); + + nWatchfaceId++; + RunApp(EDITOR_ID, EDITOR_CMD_KEY, SETUP_GET_CONTEXT_TEST_VAL, nWatchfaceId); + + IterateGmainLoop(); + if(!g_bCheckerHit) + { + FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "WatchfaceComplicationProviderSetupGetContextChecker"); + watchface_editable_remove_edit_ready_cb(SetupOnEditReadyCb); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 1; + } + if(!g_bCallBackHit) + { + FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "SetupOnEditReadyCb"); + nRet = watchface_editable_remove_edit_ready_cb(SetupOnEditReadyCb); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 1; + } + nRet = watchface_editable_remove_edit_ready_cb(SetupOnEditReadyCb); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 0; +} + +//& purpose: To set short text data for shared data +//& type: auto +/** +* @testcase ITc_watchface_complication_provider_data_set_short_text_p +* @since_tizen 5.0 +* @author SRID(karanam.s) +* @reviewer SRID(manoj.g2) +* @type auto +* @description Sets short text data for shared data. +* @scenario Sets short text data for shared data. +* @apicovered watchface_complication_provider_data_set_short_text +* @passcase watchface_complication_provider_data_set_short_text returns 0 +* @failcase watchface_complication_provider_data_set_short_text returns 1 +* @precondition N/A +* @postcondition N/A +* */ +int ITc_watchface_complication_provider_data_set_short_text_p(void) +{ + START_TEST; + int nRet = watchface_complication_provider_add_update_requested_cb(PROVIDER_ID, UpdateRequestedCb2, NULL); + if(g_bFeatureNotSupported) + return 0; + if(g_bIsFeatureMismatched) + return 1; + PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_add_update_requested_cb", WatchfaceComplicationGetError(nRet)); + g_bCallBackHit = false; + nWatchfaceId++; + RunApp(COMPLICATION_TEST_APP, "COMP_TYPE", "SHORT_TEXT", nWatchfaceId); + + IterateGmainLoop(); + if(!g_bCallBackHit) + { + FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "UpdateRequestedCb2"); + nRet = watchface_complication_provider_remove_update_requested_cb(PROVIDER_ID, UpdateRequestedCb2); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_remove_update_requested_cb", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 1; + } + nRet = watchface_complication_provider_remove_update_requested_cb(PROVIDER_ID, UpdateRequestedCb2); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_remove_update_requested_cb", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 0; +} + +//& purpose: To set long text data for shared data +//& type: auto +/** +* @testcase ITc_watchface_complication_provider_data_set_long_text_p +* @since_tizen 5.0 +* @author SRID(karanam.s) +* @reviewer SRID(manoj.g2) +* @type auto +* @description Sets long text data for shared data. +* @scenario Sets long text data for shared data. +* @apicovered watchface_complication_provider_data_set_long_text +* @passcase watchface_complication_provider_data_set_long_text returns 0 +* @failcase watchface_complication_provider_data_set_long_text returns 1 +* @precondition N/A +* @postcondition N/A +* */ +int ITc_watchface_complication_provider_data_set_long_text_p(void) +{ + START_TEST; + g_bCallBackHit = false; + int nRet = watchface_complication_provider_add_update_requested_cb(PROVIDER_ID, UpdateRequestedCb2, NULL); + if(g_bFeatureNotSupported) + return 0; + if(g_bIsFeatureMismatched) + return 1; + PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_add_update_requested_cb", WatchfaceComplicationGetError(nRet)); + + nWatchfaceId++; + RunApp(COMPLICATION_TEST_APP, "COMP_TYPE", "LONG_TEXT", nWatchfaceId); + IterateGmainLoop(); + if(!g_bCallBackHit) + { + FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "UpdateRequestedCb2"); + nRet = watchface_complication_provider_remove_update_requested_cb(PROVIDER_ID, UpdateRequestedCb2); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_remove_update_requested_cb", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 1; + } + nRet = watchface_complication_provider_remove_update_requested_cb(PROVIDER_ID, UpdateRequestedCb2); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_remove_update_requested_cb", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 0; +} + +//& purpose: To set title data for shared data +//& type: auto +/** +* @testcase ITc_watchface_complication_provider_data_set_title_p +* @since_tizen 5.0 +* @author SRID(karanam.s) +* @reviewer SRID(manoj.g2) +* @type auto +* @description Sets title data for shared data. +* @scenario Sets title data for shared data. +* @apicovered watchface_complication_provider_data_set_title +* @passcase watchface_complication_provider_data_set_title returns 0 +* @failcase watchface_complication_provider_data_set_title returns 1 +* @precondition N/A +* @postcondition N/A +* */ +int ITc_watchface_complication_provider_data_set_title_p(void) +{ + START_TEST; + int nRet = watchface_complication_provider_add_update_requested_cb(PROVIDER_ID, UpdateRequestedCb2, NULL); + if(g_bFeatureNotSupported) + return 0; + if(g_bIsFeatureMismatched) + return 1; + PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_add_update_requested_cb", WatchfaceComplicationGetError(nRet)); + g_bCallBackHit = false; + nWatchfaceId++; + RunApp(COMPLICATION_TEST_APP, "COMP_TYPE", "SHORT_TEXT", nWatchfaceId); + + IterateGmainLoop(); + if(!g_bCallBackHit) + { + FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "UpdateRequestedCb2"); + nRet = watchface_complication_provider_remove_update_requested_cb(PROVIDER_ID, UpdateRequestedCb2); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_remove_update_requested_cb", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 1; + } + nRet = watchface_complication_provider_remove_update_requested_cb(PROVIDER_ID, UpdateRequestedCb2); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_remove_update_requested_cb", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 0; +} + +//& purpose: To set timestamp data for shared data +//& type: auto +/** +* @testcase ITc_watchface_complication_provider_data_set_timestamp_p +* @since_tizen 5.0 +* @author SRID(karanam.s) +* @reviewer SRID(manoj.g2) +* @type auto +* @description Sets timestamp data for shared data. +* @scenario Sets timestamp data for shared data. +* @apicovered watchface_complication_provider_data_set_timestamp +* @passcase watchface_complication_provider_data_set_timestamp returns 0 +* @failcase watchface_complication_provider_data_set_timestamp returns 1 +* @precondition N/A +* @postcondition N/A +* */ +int ITc_watchface_complication_provider_data_set_timestamp_p(void) +{ + START_TEST; + int nRet = watchface_complication_provider_add_update_requested_cb(PROVIDER_ID, UpdateRequestedCb2, NULL); + if(g_bFeatureNotSupported) + return 0; + if(g_bIsFeatureMismatched) + return 1; + PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_add_update_requested_cb", WatchfaceComplicationGetError(nRet)); + + g_bCallBackHit = false; + nWatchfaceId++; + RunApp(COMPLICATION_TEST_APP, "COMP_TYPE", "TIME", nWatchfaceId); + + IterateGmainLoop(); + if(!g_bCallBackHit) + { + FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "UpdateRequestedCb2"); + nRet = watchface_complication_provider_remove_update_requested_cb(PROVIDER_ID, UpdateRequestedCb2); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_remove_update_requested_cb", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 1; + } + nRet = watchface_complication_provider_remove_update_requested_cb(PROVIDER_ID, UpdateRequestedCb2); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_remove_update_requested_cb", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 0; +} + +//& purpose: To set image path data for shared data +//& type: auto +/** +* @testcase ITc_watchface_complication_provider_data_set_image_path_p +* @since_tizen 5.0 +* @author SRID(karanam.s) +* @reviewer SRID(manoj.g2) +* @type auto +* @description Sets image path data for shared data. +* @scenario Sets image path data for shared data. +* @apicovered watchface_complication_provider_data_set_image_path +* @passcase watchface_complication_provider_data_set_image_path returns 0 +* @failcase watchface_complication_provider_data_set_image_path returns 1 +* @precondition N/A +* @postcondition N/A +* */ +int ITc_watchface_complication_provider_data_set_image_path_p(void) +{ + START_TEST; + int nRet = watchface_complication_provider_add_update_requested_cb(PROVIDER_ID, UpdateRequestedCb2, NULL); + if(g_bFeatureNotSupported) + return 0; + if(g_bIsFeatureMismatched) + return 1; + PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_add_update_requested_cb", WatchfaceComplicationGetError(nRet)); + g_bCallBackHit = false; + nWatchfaceId++; + RunApp(COMPLICATION_TEST_APP, "COMP_TYPE", "IMAGE", nWatchfaceId); + + IterateGmainLoop(); + if(!g_bCallBackHit) + { + FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "UpdateRequestedCb2"); + nRet = watchface_complication_provider_remove_update_requested_cb(PROVIDER_ID, UpdateRequestedCb2); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_remove_update_requested_cb", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 1; + } + nRet = watchface_complication_provider_remove_update_requested_cb(PROVIDER_ID, UpdateRequestedCb2); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_remove_update_requested_cb", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 0; +} + +//& purpose: To set ranged value data for shared data +//& type: auto +/** +* @testcase ITc_watchface_complication_provider_data_set_ranged_value_p +* @since_tizen 5.0 +* @author SRID(karanam.s) +* @reviewer SRID(manoj.g2) +* @type auto +* @description Sets ranged value data for shared data. +* @scenario Sets ranged value data for shared data. +* @apicovered watchface_complication_provider_data_set_ranged_value +* @passcase watchface_complication_provider_data_set_ranged_value returns 0 +* @failcase watchface_complication_provider_data_set_ranged_value returns 1 +* @precondition N/A +* @postcondition N/A +* */ +int ITc_watchface_complication_provider_data_set_ranged_value_p(void) +{ + START_TEST; + int nRet = watchface_complication_provider_add_update_requested_cb(PROVIDER_ID, UpdateRequestedCb2, NULL); + if(g_bFeatureNotSupported) + return 0; + if(g_bIsFeatureMismatched) + return 1; + PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_add_update_requested_cb", WatchfaceComplicationGetError(nRet)); + g_bCallBackHit = false; + nWatchfaceId++; + RunApp(COMPLICATION_TEST_APP, "COMP_TYPE", "RANGED_VALUE", nWatchfaceId); + + IterateGmainLoop(); + if(!g_bCallBackHit) + { + FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "UpdateRequestedCb2"); + nRet = watchface_complication_provider_remove_update_requested_cb(PROVIDER_ID, UpdateRequestedCb2); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_remove_update_requested_cb", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 1; + } + nRet = watchface_complication_provider_remove_update_requested_cb(PROVIDER_ID, UpdateRequestedCb2); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_remove_update_requested_cb", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 0; +} + +//& purpose: To set icon path data for shared data +//& type: auto +/** +* @testcase ITc_watchface_complication_provider_data_set_icon_path_p +* @since_tizen 5.0 +* @author SRID(karanam.s) +* @reviewer SRID(manoj.g2) +* @type auto +* @description Sets icon path data for shared data. +* @scenario Sets icon path data for shared data. +* @apicovered watchface_complication_provider_data_set_icon_path +* @passcase watchface_complication_provider_data_set_icon_path returns 0 +* @failcase watchface_complication_provider_data_set_icon_path returns 1 +* @precondition N/A +* @postcondition N/A +* */ +int ITc_watchface_complication_provider_data_set_icon_path_p(void) +{ + START_TEST; + int nRet = watchface_complication_provider_add_update_requested_cb(PROVIDER_ID, UpdateRequestedCb2, NULL); + if(g_bFeatureNotSupported) + return 0; + if(g_bIsFeatureMismatched) + return 1; + PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_add_update_requested_cb", WatchfaceComplicationGetError(nRet)); + g_bCallBackHit = false; + nWatchfaceId++; + RunApp(COMPLICATION_TEST_APP, "COMP_TYPE", "ICON", nWatchfaceId); + IterateGmainLoop(); + if(!g_bCallBackHit) + { + FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "UpdateRequestedCb2"); + nRet = watchface_complication_provider_remove_update_requested_cb(PROVIDER_ID, UpdateRequestedCb2); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_remove_update_requested_cb", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 1; + } + nRet = watchface_complication_provider_remove_update_requested_cb(PROVIDER_ID, UpdateRequestedCb2); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_remove_update_requested_cb", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 0; +} + +//& purpose: To set extra data for shared data +//& type: auto +/** +* @testcase ITc_watchface_complication_provider_data_set_extra_data_p +* @since_tizen 5.0 +* @author SRID(karanam.s) +* @reviewer SRID(manoj.g2) +* @type auto +* @description Sets extra data for shared data. +* @scenario Sets extra data for shared data. +* @apicovered watchface_complication_provider_data_set_extra_data +* @passcase watchface_complication_provider_data_set_extra_data returns 0 +* @failcase watchface_complication_provider_data_set_extra_data returns 1 +* @precondition N/A +* @postcondition N/A +* */ +int ITc_watchface_complication_provider_data_set_extra_data_p(void) +{ + START_TEST; + int nRet = watchface_complication_provider_add_update_requested_cb(PROVIDER_ID, UpdateRequestedCb2, NULL); + if(g_bFeatureNotSupported) + return 0; + if(g_bIsFeatureMismatched) + return 1; + PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_add_update_requested_cb", WatchfaceComplicationGetError(nRet)); + g_bCallBackHit = false; + nWatchfaceId = nWatchfaceId + 1; + RunApp(COMPLICATION_TEST_APP, "COMP_TYPE", "LONG_TEXT", nWatchfaceId); + IterateGmainLoop(); + if(!g_bCallBackHit) + { + FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "UpdateRequestedCb2"); + nRet = watchface_complication_provider_remove_update_requested_cb(PROVIDER_ID, UpdateRequestedCb2); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_remove_update_requested_cb", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 1; + } + nRet = watchface_complication_provider_remove_update_requested_cb(PROVIDER_ID, UpdateRequestedCb2); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_remove_update_requested_cb", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 0; +} + +//& purpose: To get touch event type that is transferred from watchface +//& type: auto +/** +* @testcase ITc_watchface_complication_provider_event_get_type_p +* @since_tizen 5.0 +* @author SRID(karanam.s) +* @reviewer SRID(manoj.g2) +* @type auto +* @description Gets touch event type that is transferred from watchface. +* @scenario Gets touch event type that is transferred from watchface. +* @apicovered watchface_complication_provider_event_get_type +* @passcase watchface_complication_provider_event_get_type returns 0 +* @failcase watchface_complication_provider_event_get_type returns 1 +* @precondition N/A +* @postcondition N/A +* */ +int ITc_watchface_complication_provider_event_get_type_p(void) +{ + START_TEST; + g_bCheckerHit = false; + g_pszEventCmd = EVENT_GET_EVENT_TYPE_TEST_VAL; + nWatchfaceId = nWatchfaceId + 1; + RunApp(COMPLICATION_TEST_APP, "EVENT_TEST", EVENT_GET_EVENT_TYPE_TEST_VAL, nWatchfaceId); + if(g_bFeatureNotSupported) + return 0; + if(g_bIsFeatureMismatched) + return 1; + IterateGmainLoop(); + + if(!g_bCheckerHit) + { + FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "WatchfaceComplicationProviderEventGetTypeChecker"); + service_app_exit(); + return 1; + } + service_app_exit(); + return 0; +} + +//& purpose: To get provider id of touched complication +//& type: auto +/** +* @testcase ITc_watchface_complication_provider_event_get_provider_id_p +* @since_tizen 5.0 +* @author SRID(karanam.s) +* @reviewer SRID(manoj.g2) +* @type auto +* @description Gets provider id of touched complication. +* @scenario Gets provider id of touched complication. +* @apicovered watchface_complication_provider_event_get_provider_id +* @passcase watchface_complication_provider_event_get_provider_id returns 0 +* @failcase watchface_complication_provider_event_get_provider_id returns 1 +* @precondition N/A +* @postcondition N/A +* */ +int ITc_watchface_complication_provider_event_get_provider_id_p(void) +{ + START_TEST; + g_bCheckerHit = false; + g_pszEventCmd = EVENT_GET_PROVIDER_ID_TEST_VAL; + nWatchfaceId = nWatchfaceId + 1; + RunApp(COMPLICATION_TEST_APP, "EVENT_TEST", EVENT_GET_PROVIDER_ID_TEST_VAL, nWatchfaceId); + if(g_bFeatureNotSupported) + return 0; + if(g_bIsFeatureMismatched) + return 1; + + IterateGmainLoop(); + if(!g_bCheckerHit) + { + FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "WatchfaceComplicationProviderEventGetProviderIdChecker"); + return 1; + } + return 0; +} + +//& purpose: To get complication type of touched complication +//& type: auto +/** +* @testcase ITc_watchface_complication_provider_event_get_complication_type_p +* @since_tizen 5.0 +* @author SRID(karanam.s) +* @reviewer SRID(manoj.g2) +* @type auto +* @description Gets complication type of touched complication. +* @scenario Gets complication type of touched complication. +* @apicovered watchface_complication_provider_event_get_complication_type +* @passcase watchface_complication_provider_event_get_complication_type returns 0 +* @failcase watchface_complication_provider_event_get_complication_type returns 1 +* @precondition N/A +* @postcondition N/A +* */ +int ITc_watchface_complication_provider_event_get_complication_type_p(void) +{ + START_TEST; + g_bCheckerHit = false; + g_pszEventCmd = EVENT_GET_COMP_TYPE_TEST_VAL; + nWatchfaceId = nWatchfaceId + 1; + RunApp(COMPLICATION_TEST_APP, "EVENT_TEST", EVENT_GET_COMP_TYPE_TEST_VAL, nWatchfaceId); + if(g_bFeatureNotSupported) + return 0; + if(g_bIsFeatureMismatched) + return 1; + + IterateGmainLoop(); + if(!g_bCheckerHit) + { + FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "WatchfaceComplicationProviderEventGetComplicationTypeChecker"); + return 1; + } + return 0; +} + +//& purpose: To get complication context of touched complication +//& type: auto +/** +* @testcase ITc_watchface_complication_provider_event_get_context_p +* @since_tizen 5.0 +* @author SRID(karanam.s) +* @reviewer SRID(manoj.g2) +* @type auto +* @description Gets complication context of touched complication. +* @scenario Gets complication context of touched complication. +* @apicovered watchface_complication_provider_event_get_context +* @passcase watchface_complication_provider_event_get_context returns 0 +* @failcase watchface_complication_provider_event_get_context returns 1 +* @precondition N/A +* @postcondition N/A +* */ +int ITc_watchface_complication_provider_event_get_context_p(void) +{ + START_TEST; + g_bCheckerHit = false; + g_pszEventCmd = EVENT_GET_CONTEXT_TEST_VAL; + nWatchfaceId = nWatchfaceId + 1; + RunApp(COMPLICATION_TEST_APP, "EVENT_TEST", EVENT_GET_CONTEXT_TEST_VAL, nWatchfaceId); + if(g_bFeatureNotSupported) + return 0; + if(g_bIsFeatureMismatched) + return 1; + + IterateGmainLoop(); + if(!g_bCheckerHit) + { + FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "WatchfaceComplicationProviderEventGetContextChecker"); + return 1; + } + return 0; +} + +//& purpose: To set screen reader text for shared data +//& type: auto +/** +* @testcase ITc_watchface_complication_provider_data_set_screen_reader_text_p +* @since_tizen 5.0 +* @author SRID(karanam.s) +* @reviewer SRID(manoj.g2) +* @type auto +* @description Sets screen reader text for shared data. +* @scenario Sets screen reader text for shared data. +* @apicovered watchface_complication_provider_data_set_screen_reader_text +* @passcase watchface_complication_provider_data_set_screen_reader_text returns 0 +* @failcase watchface_complication_provider_data_set_screen_reader_text returns 1 +* @precondition N/A +* @postcondition N/A +* */ +int ITc_watchface_complication_provider_data_set_screen_reader_text_p(void) +{ + START_TEST; + bundle *pszSharedData = bundle_create(); + int nRet = get_last_result(); + PRINT_RESULT_EXIT(nRet, BUNDLE_ERROR_NONE, "bundle_create", BundleGetError(nRet)); + CALLBACK_CHECK_HANDLE_EXIT_CLEANUP(pszSharedData, "bundle_create", app_control_destroy(g_hTestControl)); + nRet = watchface_complication_provider_data_set_screen_reader_text(pszSharedData, "screen_reader_text test"); + ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_provider_data_set_screen_reader_text"); + PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_data_set_screen_reader_text", WatchfaceComplicationGetError(nRet)); + + bundle_free(pszSharedData); + service_app_exit(); + return 0; +} + +//& purpose: To check whether shared data is valid or not +//& type: auto +/** +* @testcase ITc_watchface_complication_provider_data_is_valid_p +* @since_tizen 5.0 +* @author SRID(karanam.s) +* @reviewer SRID(manoj.g2) +* @type auto +* @description Check whether shared data is valid or not. +* @scenario Check whether shared data is valid or not. +* @apicovered ITc_watchface_complication_provider_data_is_valid_p +* @passcase ITc_watchface_complication_provider_data_is_valid_p returns 0 +* @failcase ITc_watchface_complication_provider_data_is_valid_p returns 1 +* @precondition N/A +* @postcondition N/A +* */ +int ITc_watchface_complication_provider_data_is_valid_p(void) +{ + START_TEST; + g_bCallBackHit = false; + int nRet = watchface_complication_provider_add_update_requested_cb(PROVIDER_ID, WatchfaceComplicationProviderDataIsValidCb, g_pszCheckUserData); + if(g_bFeatureNotSupported) + return 0; + if(g_bIsFeatureMismatched) + return 1; + PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_data_is_valid", WatchfaceComplicationGetError(nRet)); + + RunApp(COMPLICATION_TEST_APP, "COMP_TYPE", "SHORT_TEXT", DATAISVALIDID); + IterateGmainLoop(); + + if(!g_bCallBackHit) + { + FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "WatchfaceComplicationProviderDataIsValidCb"); + nRet = watchface_complication_provider_remove_update_requested_cb(PROVIDER_ID, WatchfaceComplicationProviderDataIsValidCb); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_remove_update_requested_cb", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 1; + } + + nRet = watchface_complication_provider_remove_update_requested_cb(PROVIDER_ID, WatchfaceComplicationProviderDataIsValidCb); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_remove_update_requested_cb", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 0; +} diff --git a/src/itc/watchface-complication/ITs-watchface-complication.c b/src/itc/watchface-complication/ITs-watchface-complication.c new file mode 100755 index 000000000..4d00466f1 --- /dev/null +++ b/src/itc/watchface-complication/ITs-watchface-complication.c @@ -0,0 +1,1318 @@ +// +// Copyright (c) 2019 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 +#include +#include +#include +#include +#include "ITs-watchface-common.h" +#define PROVIDER_ID "org.tizen.watchface_sample_provider/test" +static int nComplicatoinId = 1; + +/** @addtogroup itc-watchface +* @ingroup itc +* @{ +*/ + + +//& set: watchface + +/** +* @function ITs_watchface_complication_startup +* @description Called before each test, set the service boolean true +* @parameter NA +* @nReturn NA +*/ +void ITs_watchface_complication_startup(void) +{ +#if DEBUG + FPRINTF("[Line : %d][%s] TEST SUIT start-up: ITs_Watchface_Complication_p\\n", __LINE__, API_NAMESPACE); +#endif + g_bWatchApp = TCTCheckSystemInfoFeatureSupported(FEATURE_WATCH_APP, API_NAMESPACE); + g_bFeatureNotSupported = false; + g_bIsFeatureMismatched = false; + return; +} + +/** +* @function ITs_watchface_complication_cleanup +* @description Called after each test +* @parameter NA +* @nReturn NA +*/ +void ITs_watchface_complication_cleanup(void) +{ +#if DEBUG + FPRINTF("[Line : %d][%s] TEST SUIT clean-up: ITs_Watchface_Complication_p\\n", __LINE__, API_NAMESPACE); +#endif + return; +} +/****************************************************Callback Start****************************************************/ + +/** +* @function WatchfaceComplicationUpdatedCb +* @description Callback Function +* @parameters int nComplicationId, const char *pszProviderId, watchface_complication_type_e eType, const bundle *pszData, void *pszUserData +* @return NA +*/ +static void WatchfaceComplicationUpdatedCb(int nComplicationId, const char *pszProviderId, watchface_complication_type_e eType, const bundle *pszData, void *pszUserData) +{ + FPRINTF("[Line : %d][%s] %s invoked\\n", __LINE__, API_NAMESPACE, "WatchfaceComplicationUpdatedCb"); + g_bCallBackHit = true; + return; +} + +/** +* @function WatchfaceEditableUpdateRequestedCb +* @description Callback Function +* @parameters const watchface_editable_h hHandle, int nSelectedIdx, const watchface_editable_edit_state_e eState, void *pszUserData +* @return NA +*/ +static void WatchfaceEditableUpdateRequestedCb(const watchface_editable_h hHandle, int nSelectedIdx, const watchface_editable_edit_state_e eState, void *pszUserData) +{ + FPRINTF("[Line : %d][%s] %s invoked\\n", __LINE__, API_NAMESPACE, "WatchfaceEditableUpdateRequestedCb"); + g_bCallBackHit = true; + return; +} + +/** +* @function WatchfaceComplicationProviderUpdateRequestedCb +* @description Callback Function +* @parameters const char *pszProviderId, const char *pszReqAppid, watchface_complication_type_e eType, const bundle *pszContext, bundle *pszShareData, void *pszUserData +* @return NA +*/ +static void WatchfaceComplicationProviderUpdateRequestedCb(const char *pszProviderId, const char *pszReqAppid, watchface_complication_type_e eType, const bundle *pszContext, bundle *pszShareData, void *pszUserData) +{ + FPRINTF("[Line : %d][%s] %s invoked\\n", __LINE__, API_NAMESPACE, "WatchfaceComplicationProviderUpdateRequestedCb"); + g_bCallBackHit = true; + return; +} + +/** +* @function WatchfaceComplicationErrorCb +* @description Callback Function +* @parameters int nComplicationId,const char *pszProviderId,watchface_complication_type_e eType,watchface_complication_error_e eError,void *pszUserData +* @return NA +*/ +static void WatchfaceComplicationErrorCb(int nComplicationId, const char *pszProviderId,watchface_complication_type_e eType,watchface_complication_error_e eError,void *pszUserData) +{ + FPRINTF("[Line : %d][%s] %s invoked\\n", __LINE__, API_NAMESPACE, "WatchfaceComplicationErrorCb"); + g_bCallBackHit = true; + return; +} + +/** +* @function TypeComplicationUpdatedCb +* @description Callback Function +* @parameters int nComplicationId,const char *pszProviderId,watchface_complication_type_e eType,const bundle *pszData, void *pszUserData +* @return NA +*/ + +static void TypeComplicationUpdatedCb(int nComplicationId,const char *pszProviderId,watchface_complication_type_e eType,const bundle *pszData, void *pszUserData) +{ + char *pszText; + watchface_complication_type_e eDataType; + int nRet; + + FPRINTF("[Line : %d][%s] %s invoked\\n", __LINE__, API_NAMESPACE, "TypeComplicationUpdatedCb"); + nRet = watchface_complication_data_get_type(pszData, &eDataType); + CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_data_get_type", WatchfaceComplicationGetError(nRet)); + if( eDataType < WATCHFACE_COMPLICATION_TYPE_NO_DATA || eDataType > WATCHFACE_COMPLICATION_TYPE_IMAGE ) + { + FPRINTF("[Line : %d][%s] %s failed. eDataType = %d\\n", __LINE__, API_NAMESPACE, "watchface_complication_data_get_type", eDataType); + service_app_exit(); + return; + } + + g_bCallBackHit = true; + service_app_exit(); + return; +} + +/** +* @function ShortTextComplicationUpdatedCb +* @description Callback Function +* @parameters int nComplicationId,const char *pszProviderId,watchface_complication_type_e eType,const bundle *pszData, void *pszUserData +* @return NA +*/ +static void ShortTextComplicationUpdatedCb(int nComplicationId,const char *pszProviderId,watchface_complication_type_e eType,const bundle *pszData, void *pszUserData) +{ + char *pszText = NULL; + FPRINTF("[Line : %d][%s] %s invoked\\n", __LINE__, API_NAMESPACE, "ShortTextComplicationUpdatedCb"); + int nRet = watchface_complication_data_get_short_text(pszData, &pszText); + CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_data_get_short_text", WatchfaceComplicationGetError(nRet)); + CALLBACK_CHECK_HANDLE_EXIT(pszText, "watchface_complication_data_get_short_text"); + + FREE_MEMORY(pszText); + g_bCallBackHit = true; + service_app_exit(); + return; +} + +/** +* @function LongTextComplicationUpdatedCb +* @description Callback Function +* @parameters int nComplicationId,const char *pszProviderId,watchface_complication_type_e eType,const bundle *pszData, void *pszUserData +* @return NA +*/ +static void LongTextComplicationUpdatedCb(int nComplicationId,const char *pszProviderId,watchface_complication_type_e eType,const bundle *pszData, void *pszUserData) +{ + char *pszText = NULL; + FPRINTF("[Line : %d][%s] %s invoked\\n", __LINE__, API_NAMESPACE, "LongTextComplicationUpdatedCb"); + int nRet = watchface_complication_data_get_long_text(pszData, &pszText); + CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_data_get_long_text", WatchfaceComplicationGetError(nRet)); + CALLBACK_CHECK_HANDLE_EXIT(pszText, "watchface_complication_data_get_long_text"); + FREE_MEMORY(pszText); + + g_bCallBackHit = true; + service_app_exit(); + return; +} + +/** +* @function TitleComplicationUpdatedCb +* @description Callback Function +* @parameters int nComplicationId,const char *pszProviderId,watchface_complication_type_e eType,const bundle *pszData, void *pszUserData +* @return NA +*/ +static void TitleComplicationUpdatedCb(int nComplicationId,const char *pszProviderId,watchface_complication_type_e eType,const bundle *pszData, void *pszUserData) +{ + char *pszText = NULL; + FPRINTF("[Line : %d][%s] %s invoked\\n", __LINE__, API_NAMESPACE, "TitleComplicationUpdatedCb"); + int nRet = watchface_complication_data_get_title(pszData, &pszText); + CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_data_get_title", WatchfaceComplicationGetError(nRet)); + CALLBACK_CHECK_HANDLE_EXIT(pszText, "watchface_complication_data_get_title"); + FREE_MEMORY(pszText); + + g_bCallBackHit = true; + service_app_exit(); + return; +} + +/** +* @function TimeComplicationUpdatedCb +* @description Callback Function +* @parameters int nComplicationId,const char *pszProviderId,watchface_complication_type_e eType,const bundle *pszData, void *pszUserData +* @return NA +*/ +static void TimeComplicationUpdatedCb(int nComplicationId,const char *pszProviderId,watchface_complication_type_e eType,const bundle *pszData, void *pszUserData) +{ + long nTimeStamp = -1; + FPRINTF("[Line : %d][%s] %s invoked\\n", __LINE__, API_NAMESPACE, "TimeComplicationUpdatedCb"); + int nRet = watchface_complication_data_get_timestamp(pszData, &nTimeStamp); + CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_data_get_timestamp", WatchfaceComplicationGetError(nRet)); + if( nTimeStamp < 0 ) + { + FPRINTF("[Line : %d][%s] %s failed. nTimeStamp = %d\\n", __LINE__, API_NAMESPACE, "watchface_complication_data_get_timestamp", nTimeStamp); + service_app_exit(); + return; + } + + g_bCallBackHit = true; + service_app_exit(); + return; +} + +/** +* @function ImageComplicationUpdatedCb +* @description Callback Function +* @parameters int nComplicationId,const char *pszProviderId,watchface_complication_type_e eType,const bundle *pszData, void *pszUserData +* @return NA +*/ +static void ImageComplicationUpdatedCb(int nComplicationId,const char *pszProviderId,watchface_complication_type_e eType,const bundle *pszData, void *pszUserData) +{ + char *pszText; + int nRet; + + FPRINTF("[Line : %d][%s] %s invoked.\\n", __LINE__, API_NAMESPACE, "ImageComplicationUpdatedCb"); + nRet = watchface_complication_data_get_image_path(pszData, &pszText); + CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_data_get_image_path", WatchfaceComplicationGetError(nRet)); + CALLBACK_CHECK_HANDLE_EXIT(pszText, "watchface_complication_data_get_image_path"); + FREE_MEMORY(pszText); + + g_bCallBackHit = true; + service_app_exit(); + return; +} + +/** +* @function RangedValueComplicationUpdatedCb +* @description Callback Function +* @parameters int nComplicationId,const char *pszProviderId,watchface_complication_type_e eType,const bundle *pszData, void *pszUserData +* @return NA +*/ +static void RangedValueComplicationUpdatedCb(int nComplicationId,const char *pszProviderId,watchface_complication_type_e eType,const bundle *pszData, void *pszUserData) +{ + char *pszText; + int nRet; + double nCurrentValue = -1; + double nMinValue = -1; + double nMaxValue = -1; + + FPRINTF("[Line : %d][%s] %s invoked.\\n", __LINE__, API_NAMESPACE, "RangedValueComplicationUpdatedCb"); + nRet = watchface_complication_data_get_ranged_value(pszData, &nCurrentValue, &nMinValue, &nMaxValue); + CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_data_get_ranged_value", WatchfaceComplicationGetError(nRet)); + if( nCurrentValue < 0 ) + { + FPRINTF("[Line : %d][%s] %s failed. nCurrentValue = %d\\n", __LINE__, API_NAMESPACE, "watchface_complication_data_get_ranged_value", nCurrentValue); + service_app_exit(); + return; + } + if( nMinValue < 0 ) + { + FPRINTF("[Line : %d][%s] %s failed. nMinValue = %d\\n", __LINE__, API_NAMESPACE, "watchface_complication_data_get_ranged_value", nMinValue); + service_app_exit(); + return; + } + if( nMaxValue < 0 ) + { + FPRINTF("[Line : %d][%s] %s failed. nMaxValue = %d\\n", __LINE__, API_NAMESPACE, "watchface_complication_data_get_ranged_value", nMaxValue); + service_app_exit(); + return; + } + + g_bCallBackHit = true; + service_app_exit(); + return; +} + +/** +* @function IconComplicationUpdatedCb +* @description Callback Function +* @parameters int nComplicationId,const char *pszProviderId,watchface_complication_type_e eType,const bundle *pszData, void *pszUserData +* @return NA +*/ +static void IconComplicationUpdatedCb(int nComplicationId,const char *pszProviderId,watchface_complication_type_e eType,const bundle *pszData, void *pszUserData) +{ + char *pszText = NULL; + FPRINTF("[Line : %d][%s] %s invoked.\\n", __LINE__, API_NAMESPACE, "IconComplicationUpdatedCb"); + int nRet = watchface_complication_data_get_icon_path(pszData, &pszText); + CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_data_get_icon_path", WatchfaceComplicationGetError(nRet)); + CALLBACK_CHECK_HANDLE_EXIT(pszText, "watchface_complication_data_get_icon_path"); + FREE_MEMORY(pszText); + + g_bCallBackHit = true; + service_app_exit(); + return; +} + +/** +* @function ExtraDataComplicationUpdatedCb +* @description Callback Function +* @parameters int nComplicationId,const char *pszProviderId,watchface_complication_type_e eType,const bundle *pszData, void *pszUserData +* @return NA +*/ +static void ExtraDataComplicationUpdatedCb(int nComplicationId,const char *pszProviderId,watchface_complication_type_e eType,const bundle *pszData, void *pszUserData) +{ + char *pszExtraData = NULL; + + FPRINTF("[Line : %d][%s] %s invoked.\\n", __LINE__, API_NAMESPACE, "ExtraDataComplicationUpdatedCb"); + int nRet = watchface_complication_data_get_extra_data(pszData, &pszExtraData); + CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_data_get_extra_data", WatchfaceComplicationGetError(nRet)); + CALLBACK_CHECK_HANDLE_EXIT(pszExtraData, "watchface_complication_data_get_extra_data"); + FREE_MEMORY(pszExtraData); + + g_bCallBackHit = true; + return; +} + +static void ScreenReaderCb(int nComplicationId, const char *pszProviderId, watchface_complication_type_e eType, const bundle *pszData, void *pszUserData) +{ + char *pszText = NULL; + + FPRINTF("[Line : %d][%s] %s invoked.\\n", __LINE__, API_NAMESPACE, "ScreenReaderCb"); + int nRet = watchface_complication_data_get_screen_reader_text(pszData, &pszText); + CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_data_get_screen_reader_text", WatchfaceComplicationGetError(nRet)); + CALLBACK_CHECK_HANDLE_EXIT(pszText, "watchface_complication_data_get_screen_reader_text"); + FREE_MEMORY(pszText); + + g_bCallBackHit = true; + service_app_exit(); + return; +} + + +/*****************************************************Callback End*****************************************************/ +//& purpose: To get the id of provider in the complication +//& type: auto +/** +* @testcase ITc_watchface_complication_get_current_provider_id_p +* @since_tizen 5.0 +* @author SRID(samuel.peter) +* @reviewer SRID(manoj.g2) +* @type auto +* @description Gets the id of provider in the complication. +* @scenario Gets the id of provider in the complication. +* @apicovered watchface_complication_get_current_provider_id +* @passcase watchface_complication_get_current_provider_id returns 0 +* @failcase watchface_complication_get_current_provider_id returns 1 +* @precondition Complication handle should be created by watchface_complication_create(). +* @postcondition N/A +* */ +int ITc_watchface_complication_get_current_provider_id_p(void) +{ + START_TEST; + complication_h hHandle = NULL; + char *pszCurProvider = NULL; + int nRet = 0; + + nComplicatoinId++; + nRet = watchface_complication_create(nComplicatoinId, PROVIDER_ID, WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT, WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT, WATCHFACE_COMPLICATION_EVENT_NONE, &hHandle); + ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_create"); + PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_create", WatchfaceComplicationGetError(nRet)); + CHECK_HANDLE_EXIT(hHandle, "watchface_complication_create"); + + nRet = watchface_complication_get_current_provider_id(hHandle, &pszCurProvider); + PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_get_current_provider_id", WatchfaceComplicationGetError(nRet), watchface_complication_destroy(hHandle)); + CHECK_HANDLE_EXIT_CLEANUP(pszCurProvider, "watchface_complication_get_current_provider_id", watchface_complication_destroy(hHandle)); + FREE_MEMORY(pszCurProvider); + + nRet = watchface_complication_destroy(hHandle); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_destroy", WatchfaceComplicationGetError(nRet)); + + service_app_exit(); + return 0; +} + +//& purpose: To get the currently set type of the complication +//& type: auto +/** +* @testcase ITc_watchface_complication_get_current_type_p +* @since_tizen 5.0 +* @author SRID(samuel.peter) +* @reviewer SRID(manoj.g2) +* @type auto +* @description Gets the currently set type of the complication. +* @scenario Gets the currently set type of the complication. +* @apicovered watchface_complication_get_current_type +* @passcase watchface_complication_get_current_type returns 0 +* @failcase watchface_complication_get_current_type returns 1 +* @precondition N/A +* @postcondition N/A +* */ +int ITc_watchface_complication_get_current_type_p(void) +{ + START_TEST; + complication_h hHandle = NULL; + int nRet = 0; + watchface_complication_type_e eCurType; + + nComplicatoinId++; + nRet = watchface_complication_create(nComplicatoinId, PROVIDER_ID, WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT, WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT, WATCHFACE_COMPLICATION_EVENT_NONE, &hHandle); + ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_create"); + PRINT_RESULT_EXIT(WATCHFACE_COMPLICATION_ERROR_NONE, nRet, "watchface_complication_create", WatchfaceComplicationGetError(nRet)); + CHECK_HANDLE_EXIT(hHandle, "watchface_complication_create"); + + nRet = watchface_complication_get_current_type(hHandle, &eCurType); + PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_get_current_type", WatchfaceComplicationGetError(nRet), watchface_complication_destroy(hHandle)); + if( eCurType < WATCHFACE_COMPLICATION_TYPE_NO_DATA || eCurType > WATCHFACE_COMPLICATION_TYPE_IMAGE ) + { + FPRINTF("[Line : %d][%s] %s failed. eCurType = %d\\n", __LINE__, API_NAMESPACE, "watchface_complication_get_current_type", eCurType); + watchface_complication_destroy(hHandle); + service_app_exit(); + return 1; + } + + nRet = watchface_complication_destroy(hHandle); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_destroy", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 0; +} + +//& purpose: To add and remove the callback function to use for complication update +//& type: auto +/** +* @testcase ITc_watchface_complication_add__update_remove_updated_cb_p +* @since_tizen 5.0 +* @author SRID(samuel.peter) +* @reviewer SRID(manoj.g2) +* @type auto +* @description Adds and removes the callback function to use for complication update. +* @scenario Adds and removes the callback function to use for complication update. +* @apicovered watchface_complication_add_updated_cb, watchface_complication_send_update_request, watchface_complication_remove_updated_cb +* @passcase Target APIs return 0 +* @failcase Target APIs return 1 +* @precondition Complication handle should be created by watchface_complication_create(). +* @postcondition N/A +* */ +int ITc_watchface_complication_add_update_remove_updated_cb_p(void) +{ + START_TEST; + complication_h hHandle = NULL; + nComplicatoinId++; + + int nRet = watchface_complication_create(nComplicatoinId, PROVIDER_ID, WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT, WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT, WATCHFACE_COMPLICATION_EVENT_NONE, &hHandle); + ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_create"); + PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_create", WatchfaceComplicationGetError(nRet)); + CHECK_HANDLE_EXIT(hHandle, "watchface_complication_create"); + + nRet = watchface_complication_add_updated_cb(hHandle, WatchfaceComplicationUpdatedCb, WatchfaceComplicationErrorCb, NULL); + PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_add_updated_cb", WatchfaceComplicationGetError(nRet), watchface_complication_destroy(hHandle)); + + g_bCallBackHit = false; + + nRet = watchface_complication_send_update_request(hHandle); + PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_send_update_request", WatchfaceComplicationGetError(nRet), watchface_complication_remove_updated_cb(hHandle, WatchfaceComplicationUpdatedCb); watchface_complication_destroy(hHandle)); + + IterateGmainLoop(); + if(!g_bCallBackHit) + { + FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "WatchfaceComplicationUpdatedCb"); + nRet = watchface_complication_remove_updated_cb(hHandle, WatchfaceComplicationUpdatedCb); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_remove_updated_cb", WatchfaceComplicationGetError(nRet)); + nRet = watchface_complication_destroy(hHandle); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_destroy", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 1; + } + + nRet = watchface_complication_remove_updated_cb(hHandle, WatchfaceComplicationUpdatedCb); + PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_remove_updated_cb", WatchfaceComplicationGetError(nRet), watchface_complication_destroy(hHandle)); + + nRet = watchface_complication_destroy(hHandle); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_destroy", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + + return 0; +} + +//& purpose: To create and destroy a complication handle +//& type: auto +/** +* @testcase ITc_watchface_complication_create_destroy_p +* @since_tizen 5.0 +* @author SRID(samuel.peter) +* @reviewer SRID(manoj.g2) +* @type auto +* @description Creates and destroys a complication handle. +* @scenario Creates and destroys a complication handle. +* @apicovered watchface_complication_create, watchface_complication_destroy +* @passcase watchface_complication_create_destroy returns 0 +* @failcase watchface_complication_create_destroy returns 1 +* @precondition N/A +* @postcondition N/A +* */ +int ITc_watchface_complication_create_destroy_p(void) +{ + START_TEST; + complication_h hHandle = NULL; + int nRet = 0; + + nComplicatoinId++; + nRet = watchface_complication_create(nComplicatoinId, PROVIDER_ID, WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT, WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT, WATCHFACE_COMPLICATION_EVENT_NONE, &hHandle); + ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_create"); + PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_create", WatchfaceComplicationGetError(nRet)); + CHECK_HANDLE_EXIT(hHandle, "watchface_complication_create"); + + nRet = watchface_complication_destroy(hHandle); + PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_destroy", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 0; +} + +//& purpose: To get data type of complication data. +//& type: auto +/** +* @testcase ITc_watchface_complication_data_get_type_p +* @since_tizen 5.0 +* @author SRID(samuel.peter) +* @reviewer SRID(manoj.g2) +* @type auto +* @description Gets data type of complication data. +* @scenario Gets data type of complication data. +* @apicovered watchface_complication_data_get_type +* @passcase watchface_complication_data_get_type returns 0 +* @failcase watchface_complication_data_get_type returns 1 +* @precondition N/A +* @postcondition N/A +* */ + +int ITc_watchface_complication_data_get_type_p(void) +{ + START_TEST; + complication_h hHandle = NULL; + + nComplicatoinId++; + int nRet = watchface_complication_create(nComplicatoinId, PROVIDER_ID, WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT, WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT, WATCHFACE_COMPLICATION_EVENT_NONE, &hHandle); + ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_create"); + PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_create", WatchfaceComplicationGetError(nRet)); + CHECK_HANDLE_EXIT(hHandle, "watchface_complication_create"); + + nRet = watchface_complication_add_updated_cb(hHandle, TypeComplicationUpdatedCb, WatchfaceComplicationErrorCb, NULL); + PRINT_RESULT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_add_updated_cb", WatchfaceComplicationGetError(nRet), watchface_complication_destroy(hHandle)); + + g_bCallBackHit = false; + nRet = watchface_complication_send_update_request(hHandle); + PRINT_RESULT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_send_update_request", WatchfaceComplicationGetError(nRet), watchface_complication_remove_updated_cb(hHandle, TypeComplicationUpdatedCb); watchface_complication_destroy(hHandle)); + IterateGmainLoop(); + if(!g_bCallBackHit) + { + FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "TypeComplicationUpdatedCb"); + nRet = watchface_complication_remove_updated_cb(hHandle, TypeComplicationUpdatedCb); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_remove_updated_cb", WatchfaceComplicationGetError(nRet)); + nRet = watchface_complication_destroy(hHandle); + return 1; + } + + nRet = watchface_complication_remove_updated_cb(hHandle, TypeComplicationUpdatedCb); + PRINT_RESULT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_remove_updated_cb", WatchfaceComplicationGetError(nRet), watchface_complication_destroy(hHandle)); + + nRet = watchface_complication_destroy(hHandle); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_destroy", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 0; +} + +//& purpose: To get short text from complication data +//& type: auto +/** +* @testcase ITc_watchface_complication_data_get_short_text_p +* @since_tizen 5.0 +* @author SRID(samuel.peter) +* @reviewer SRID(manoj.g2) +* @type auto +* @description Gets short text from complication data. +* @scenario Gets short text from complication data. +* @apicovered watchface_complication_data_get_short_text +* @passcase watchface_complication_data_get_short_text returns 0 +* @failcase watchface_complication_data_get_short_text returns 1 +* @precondition N/A +* @postcondition N/A +* */ +int ITc_watchface_complication_data_get_short_text_p(void) +{ + START_TEST; + complication_h hHandle = NULL; + g_bCallBackHit = false; + + nComplicatoinId++; + int nRet = watchface_complication_create(nComplicatoinId, PROVIDER_ID, WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT, WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT, WATCHFACE_COMPLICATION_EVENT_NONE, &hHandle); + ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_create"); + PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_create", WatchfaceComplicationGetError(nRet)); + CHECK_HANDLE_EXIT(hHandle, "watchface_complication_create"); + + nRet = watchface_complication_add_updated_cb(hHandle, ShortTextComplicationUpdatedCb, WatchfaceComplicationErrorCb, NULL); + PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_add_updated_cb", WatchfaceComplicationGetError(nRet), watchface_complication_destroy(hHandle)); + + nRet = watchface_complication_send_update_request(hHandle); + PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_send_update_request", WatchfaceComplicationGetError(nRet), watchface_complication_remove_updated_cb(hHandle, ShortTextComplicationUpdatedCb); watchface_complication_destroy(hHandle)); + + IterateGmainLoop(); + if(!g_bCallBackHit) + { + FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "ShortTextComplicationUpdatedCb"); + nRet = watchface_complication_remove_updated_cb(hHandle, ShortTextComplicationUpdatedCb); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_remove_updated_cb", WatchfaceComplicationGetError(nRet)); + nRet = watchface_complication_destroy(hHandle); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_destroy", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 1; + } + + nRet = watchface_complication_remove_updated_cb(hHandle, ShortTextComplicationUpdatedCb); + PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_remove_updated_cb", WatchfaceComplicationGetError(nRet), watchface_complication_destroy(hHandle)); + + nRet = watchface_complication_destroy(hHandle); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_destroy", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 0; +} + +//& purpose: To get long text from complication data +//& type: auto +/** +* @testcase ITc_watchface_complication_data_get_long_text_p +* @since_tizen 5.0 +* @author SRID(samuel.peter) +* @reviewer SRID(manoj.g2) +* @type auto +* @description Gets long text from complication data. +* @scenario Gets long text from complication data. +* @apicovered watchface_complication_data_get_long_text +* @passcase watchface_complication_data_get_long_text returns 0 +* @failcase watchface_complication_data_get_long_text returns 1 +* @precondition N/A +* @postcondition N/A +* */ +int ITc_watchface_complication_data_get_long_text_p(void) +{ + START_TEST; + complication_h hHandle = NULL; + + nComplicatoinId++; + int nRet = watchface_complication_create(nComplicatoinId, PROVIDER_ID, WATCHFACE_COMPLICATION_TYPE_LONG_TEXT, WATCHFACE_COMPLICATION_TYPE_LONG_TEXT, WATCHFACE_COMPLICATION_EVENT_NONE, &hHandle); + ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_create"); + PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_create", WatchfaceComplicationGetError(nRet)); + CHECK_HANDLE_EXIT(hHandle, "watchface_complication_create"); + + nRet = watchface_complication_add_updated_cb(hHandle, LongTextComplicationUpdatedCb, WatchfaceComplicationErrorCb, NULL); + PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_add_updated_cb", WatchfaceComplicationGetError(nRet), watchface_complication_destroy(hHandle)); + + g_bCallBackHit = false; + nRet = watchface_complication_send_update_request(hHandle); + PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_send_update_request", WatchfaceComplicationGetError(nRet), watchface_complication_remove_updated_cb(hHandle, LongTextComplicationUpdatedCb); watchface_complication_destroy(hHandle)); + + IterateGmainLoop(); + if(!g_bCallBackHit) + { + FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "LongTextComplicationUpdatedCb"); + nRet = watchface_complication_remove_updated_cb(hHandle, LongTextComplicationUpdatedCb); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_remove_updated_cb", WatchfaceComplicationGetError(nRet)); + nRet = watchface_complication_destroy(hHandle); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_destroy", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 1; + } + + nRet = watchface_complication_remove_updated_cb(hHandle, LongTextComplicationUpdatedCb); + PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_remove_updated_cb", WatchfaceComplicationGetError(nRet), watchface_complication_destroy(hHandle)); + + nRet = watchface_complication_destroy(hHandle); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_destroy", WatchfaceComplicationGetError(nRet)); + + service_app_exit(); + return 0; +} + +//& purpose: To get title text from complication data +//& type: auto +/** +* @testcase ITc_watchface_complication_data_get_title_p +* @since_tizen 5.0 +* @author SRID(samuel.peter) +* @reviewer SRID(manoj.g2) +* @type auto +* @description Gets title text from complication data. +* @scenario Gets title text from complication data. +* @apicovered watchface_complication_data_get_title +* @passcase watchface_complication_data_get_title returns 0 +* @failcase watchface_complication_data_get_title returns 1 +* @precondition N/A +* @postcondition N/A +* */ +int ITc_watchface_complication_data_get_title_p(void) +{ + START_TEST; + complication_h hHandle = NULL; + nComplicatoinId++; + + int nRet = watchface_complication_create(nComplicatoinId, PROVIDER_ID, WATCHFACE_COMPLICATION_TYPE_LONG_TEXT, WATCHFACE_COMPLICATION_TYPE_LONG_TEXT, WATCHFACE_COMPLICATION_EVENT_NONE, &hHandle); + ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_create"); + PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_create", WatchfaceComplicationGetError(nRet)); + CHECK_HANDLE_EXIT(hHandle, "watchface_complication_create"); + + nRet = watchface_complication_add_updated_cb(hHandle, TitleComplicationUpdatedCb, WatchfaceComplicationErrorCb, NULL); + PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_add_updated_cb", WatchfaceComplicationGetError(nRet), watchface_complication_destroy(hHandle)); + + g_bCallBackHit = false; + + nRet = watchface_complication_send_update_request(hHandle); + PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_send_update_request", WatchfaceComplicationGetError(nRet), watchface_complication_remove_updated_cb(hHandle, TitleComplicationUpdatedCb); watchface_complication_destroy(hHandle)); + + IterateGmainLoop(); + if(!g_bCallBackHit) + { + FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "TitleComplicationUpdatedCb"); + nRet = watchface_complication_remove_updated_cb(hHandle, TitleComplicationUpdatedCb); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_remove_updated_cb", WatchfaceComplicationGetError(nRet)); + nRet = watchface_complication_destroy(hHandle); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_destroy", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 1; + } + + nRet = watchface_complication_remove_updated_cb(hHandle, TitleComplicationUpdatedCb); + PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_remove_updated_cb", WatchfaceComplicationGetError(nRet), watchface_complication_destroy(hHandle)); + + nRet = watchface_complication_destroy(hHandle); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_destroy", WatchfaceComplicationGetError(nRet)); + + service_app_exit(); + return 0; +} + +//& purpose: To get timestamp from complication data +//& type: auto +/** +* @testcase ITc_watchface_complication_data_get_timestamp_p +* @since_tizen 5.0 +* @author SRID(samuel.peter) +* @reviewer SRID(manoj.g2) +* @type auto +* @description Gets timestamp from complication data. +* @scenario Gets timestamp from complication data. +* @apicovered watchface_complication_data_get_timestamp +* @passcase watchface_complication_data_get_timestamp returns 0 +* @failcase watchface_complication_data_get_timestamp returns 1 +* @precondition N/A +* @postcondition N/A +* */ +int ITc_watchface_complication_data_get_timestamp_p(void) +{ + START_TEST; + complication_h hHandle = NULL; + g_bCallBackHit = false; + nComplicatoinId++; + + int nRet = watchface_complication_create(nComplicatoinId, PROVIDER_ID, WATCHFACE_COMPLICATION_TYPE_TIME, WATCHFACE_COMPLICATION_TYPE_TIME, WATCHFACE_COMPLICATION_EVENT_NONE, &hHandle); + ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_create"); + PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_create", WatchfaceComplicationGetError(nRet)); + CHECK_HANDLE_EXIT(hHandle, "watchface_complication_create"); + nRet = watchface_complication_add_updated_cb(hHandle, TimeComplicationUpdatedCb, WatchfaceComplicationErrorCb, NULL); + PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_add_updated_cb", WatchfaceComplicationGetError(nRet), watchface_complication_destroy(hHandle)); + + nRet = watchface_complication_send_update_request(hHandle); + PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_send_update_request", WatchfaceComplicationGetError(nRet), watchface_complication_remove_updated_cb(hHandle, TimeComplicationUpdatedCb); watchface_complication_destroy(hHandle)); + + IterateGmainLoop(); + if(!g_bCallBackHit) + { + FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "TimeComplicationUpdatedCb"); + nRet = watchface_complication_remove_updated_cb(hHandle, TimeComplicationUpdatedCb); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_remove_updated_cb", WatchfaceComplicationGetError(nRet)); + nRet = watchface_complication_destroy(hHandle); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_destroy", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 1; + } + + nRet = watchface_complication_remove_updated_cb(hHandle, TimeComplicationUpdatedCb); + PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_remove_updated_cb", WatchfaceComplicationGetError(nRet), watchface_complication_destroy(hHandle)); + + nRet = watchface_complication_destroy(hHandle); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_destroy", WatchfaceComplicationGetError(nRet)); + + service_app_exit(); + return 0; +} + +//& purpose: To get image path from complication data +//& type: auto +/** +* @testcase ITc_watchface_complication_data_get_image_path_p +* @since_tizen 5.0 +* @author SRID(samuel.peter) +* @reviewer SRID(manoj.g2) +* @type auto +* @description Gets image path from complication data. +* @scenario Gets image path from complication data. +* @apicovered watchface_complication_data_get_image_path +* @passcase watchface_complication_data_get_image_path returns 0 +* @failcase watchface_complication_data_get_image_path returns 1 +* @precondition N/A +* @postcondition N/A +* */ +int ITc_watchface_complication_data_get_image_path_p(void) +{ + START_TEST; + complication_h hHandle = NULL; + g_bCallBackHit = false; + + nComplicatoinId++; + int nRet = watchface_complication_create(nComplicatoinId, PROVIDER_ID, WATCHFACE_COMPLICATION_TYPE_IMAGE, WATCHFACE_COMPLICATION_TYPE_IMAGE, WATCHFACE_COMPLICATION_EVENT_NONE, &hHandle); + ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_create"); + PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_create", WatchfaceComplicationGetError(nRet)); + CHECK_HANDLE_EXIT(hHandle, "watchface_complication_create"); + + nRet = watchface_complication_add_updated_cb(hHandle, ImageComplicationUpdatedCb, WatchfaceComplicationErrorCb, NULL); + PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_add_updated_cb", WatchfaceComplicationGetError(nRet), watchface_complication_destroy(hHandle)); + + + nRet = watchface_complication_send_update_request(hHandle); + PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_send_update_request", WatchfaceComplicationGetError(nRet), watchface_complication_remove_updated_cb(hHandle, ImageComplicationUpdatedCb); watchface_complication_destroy(hHandle)); + + IterateGmainLoop(); + if(!g_bCallBackHit) + { + FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "ImageComplicationUpdatedCb"); + nRet = watchface_complication_remove_updated_cb(hHandle, ImageComplicationUpdatedCb); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_remove_updated_cb", WatchfaceComplicationGetError(nRet)); + nRet = watchface_complication_destroy(hHandle); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_destroy", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 1; + } + + nRet = watchface_complication_remove_updated_cb(hHandle, ImageComplicationUpdatedCb); + PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_remove_updated_cb", WatchfaceComplicationGetError(nRet), watchface_complication_destroy(hHandle)); + + nRet = watchface_complication_destroy(hHandle); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_destroy", WatchfaceComplicationGetError(nRet)); + + service_app_exit(); + return 0; +} + +//& purpose: To get ranged value from complication data +//& type: auto +/** +* @testcase ITc_watchface_complication_data_get_ranged_value_p +* @since_tizen 5.0 +* @author SRID(samuel.peter) +* @reviewer SRID(manoj.g2) +* @type auto +* @description Gets ranged value from complication data. +* @scenario Gets ranged value from complication data. +* @apicovered watchface_complication_data_get_ranged_value +* @passcase watchface_complication_data_get_ranged_value returns 0 +* @failcase watchface_complication_data_get_ranged_value returns 1 +* @precondition N/A +* @postcondition N/A +* */ +int ITc_watchface_complication_data_get_ranged_value_p(void) +{ + START_TEST; + complication_h hHandle = NULL; + g_bCallBackHit = false; + + nComplicatoinId++; + int nRet = watchface_complication_create(nComplicatoinId, PROVIDER_ID, WATCHFACE_COMPLICATION_TYPE_RANGED_VALUE, WATCHFACE_COMPLICATION_TYPE_RANGED_VALUE, WATCHFACE_COMPLICATION_EVENT_NONE, &hHandle); + ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_create"); + PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_create", WatchfaceComplicationGetError(nRet)); + CHECK_HANDLE_EXIT(hHandle, "watchface_complication_create"); + + nRet = watchface_complication_add_updated_cb(hHandle, RangedValueComplicationUpdatedCb, WatchfaceComplicationErrorCb, NULL); + PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_add_updated_cb", WatchfaceComplicationGetError(nRet), watchface_complication_destroy(hHandle)); + + nRet = watchface_complication_send_update_request(hHandle); + PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_send_update_request", WatchfaceComplicationGetError(nRet), watchface_complication_remove_updated_cb(hHandle, RangedValueComplicationUpdatedCb); watchface_complication_destroy(hHandle)); + + IterateGmainLoop(); + if(!g_bCallBackHit) + { + FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "RangedValueComplicationUpdatedCb"); + nRet = watchface_complication_remove_updated_cb(hHandle, RangedValueComplicationUpdatedCb); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_remove_updated_cb", WatchfaceComplicationGetError(nRet)); + nRet = watchface_complication_destroy(hHandle); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_destroy", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 1; + } + + nRet = watchface_complication_remove_updated_cb(hHandle, RangedValueComplicationUpdatedCb); + PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_remove_updated_cb", WatchfaceComplicationGetError(nRet), watchface_complication_destroy(hHandle)); + + nRet = watchface_complication_destroy(hHandle); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_destroy", WatchfaceComplicationGetError(nRet)); + + service_app_exit(); + return 0; +} + +//& purpose: To get icon path from complication data +//& type: auto +/** +* @testcase ITc_watchface_complication_data_get_icon_path_p +* @since_tizen 5.0 +* @author SRID(samuel.peter) +* @reviewer SRID(manoj.g2) +* @type auto +* @description Gets icon path from complication data. +* @scenario Gets icon path from complication data. +* @apicovered watchface_complication_data_get_icon_path +* @passcase watchface_complication_data_get_icon_path returns 0 +* @failcase watchface_complication_data_get_icon_path returns 1 +* @precondition N/A +* @postcondition N/A +* */ +int ITc_watchface_complication_data_get_icon_path_p(void) +{ + START_TEST; + complication_h hHandle = NULL; + g_bCallBackHit = false; + + nComplicatoinId++; + int nRet = watchface_complication_create(nComplicatoinId, PROVIDER_ID, WATCHFACE_COMPLICATION_TYPE_ICON, WATCHFACE_COMPLICATION_TYPE_ICON, WATCHFACE_COMPLICATION_EVENT_NONE, &hHandle); + ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_create"); + PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_create", WatchfaceComplicationGetError(nRet)); + CHECK_HANDLE_EXIT(hHandle, "watchface_complication_create"); + + nRet = watchface_complication_add_updated_cb(hHandle, IconComplicationUpdatedCb, WatchfaceComplicationErrorCb, NULL); + PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_add_updated_cb", WatchfaceComplicationGetError(nRet), watchface_complication_destroy(hHandle)); + + nRet = watchface_complication_send_update_request(hHandle); + PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_send_update_request", WatchfaceComplicationGetError(nRet), watchface_complication_remove_updated_cb(hHandle, IconComplicationUpdatedCb); watchface_complication_destroy(hHandle)); + + IterateGmainLoop(); + if(!g_bCallBackHit) + { + FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "IconComplicationUpdatedCb"); + nRet = watchface_complication_remove_updated_cb(hHandle, IconComplicationUpdatedCb); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_remove_updated_cb", WatchfaceComplicationGetError(nRet)); + nRet = watchface_complication_destroy(hHandle); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_destroy", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 1; + } + + nRet = watchface_complication_remove_updated_cb(hHandle, IconComplicationUpdatedCb); + PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_remove_updated_cb", WatchfaceComplicationGetError(nRet), watchface_complication_destroy(hHandle)); + + nRet = watchface_complication_destroy(hHandle); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_destroy", WatchfaceComplicationGetError(nRet)); + + service_app_exit(); + return 0; +} + +//& purpose: To get extra data from complication data +//& type: auto +/** +* @testcase ITc_watchface_complication_data_get_extra_data_p +* @since_tizen 5.0 +* @author SRID(samuel.peter) +* @reviewer SRID(manoj.g2) +* @type auto +* @description Gets extra data from complication data. +* @scenario Gets extra data from complication data. +* @apicovered watchface_complication_data_get_extra_data +* @passcase watchface_complication_data_get_extra_data returns 0 +* @failcase watchface_complication_data_get_extra_data returns 1 +* @precondition N/A +* @postcondition N/A +* */ +int ITc_watchface_complication_data_get_extra_data_p(void) +{ + START_TEST; + complication_h hHandle = NULL; + g_bCallBackHit = false; + nComplicatoinId++; + + int nRet = watchface_complication_create(nComplicatoinId, PROVIDER_ID, WATCHFACE_COMPLICATION_TYPE_ICON, WATCHFACE_COMPLICATION_TYPE_ICON, WATCHFACE_COMPLICATION_EVENT_NONE, &hHandle); + ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_create"); + PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_create", WatchfaceComplicationGetError(nRet)); + CHECK_HANDLE_EXIT(hHandle, "watchface_complication_create"); + + nRet = watchface_complication_add_updated_cb(hHandle, ExtraDataComplicationUpdatedCb, WatchfaceComplicationErrorCb, NULL); + PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_add_updated_cb", WatchfaceComplicationGetError(nRet), watchface_complication_destroy(hHandle)); + + nRet = watchface_complication_send_update_request(hHandle); + PRINT_RESULT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_send_update_request", WatchfaceComplicationGetError(nRet), watchface_complication_remove_updated_cb(hHandle, ExtraDataComplicationUpdatedCb); watchface_complication_destroy(hHandle)); + + IterateGmainLoop(); + if(!g_bCallBackHit) + { + FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "ExtraDataComplicationUpdatedCb"); + nRet = watchface_complication_remove_updated_cb(hHandle, ExtraDataComplicationUpdatedCb); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_remove_updated_cb", WatchfaceComplicationGetError(nRet)); + nRet = watchface_complication_destroy(hHandle); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_destroy", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 1; + } + + nRet = watchface_complication_remove_updated_cb(hHandle, ExtraDataComplicationUpdatedCb); + PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_remove_updated_cb", WatchfaceComplicationGetError(nRet), watchface_complication_destroy(hHandle)); + + nRet = watchface_complication_destroy(hHandle); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_destroy", WatchfaceComplicationGetError(nRet)); + + service_app_exit(); + return 0; +} + +//& purpose: To create and destroy allowed list +//& type: auto +/** +* @testcase ITc_watchface_complication_allowed_list_create_destroy_p +* @since_tizen 5.0 +* @author SRID(samuel.peter) +* @reviewer SRID(manoj.g2) +* @type auto +* @description Creates and destroys allowed list. +* @scenario Creates and destroys allowed list. +* @apicovered watchface_complication_allowed_list_create, watchface_complication_allowed_list_destroy +* @passcase watchface_complication_allowed_list_create, watchface_complication_allowed_list_destroy return 0 +* @failcase watchface_complication_allowed_list_create, watchface_complication_allowed_list_destroy return 1 +* @precondition N/A +* @postcondition N/A +* */ + +int ITc_watchface_complication_allowed_list_create_destroy_p(void) +{ + START_TEST; + complication_allowed_list_h hHandle = NULL; + int nRet = 0; + + nRet = watchface_complication_allowed_list_create(&hHandle); + ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_allowed_list_create"); + PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_allowed_list_create", WatchfaceComplicationGetError(nRet)); + CHECK_HANDLE(hHandle, "watchface_complication_allowed_list_create"); + + nRet = watchface_complication_allowed_list_destroy(hHandle); + PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_allowed_list_destroy", WatchfaceComplicationGetError(nRet)); + + service_app_exit(); + return 0; +} + +//& purpose: To add and delete provider info from the allowed list +//& type: auto +/** +* @testcase ITc_watchface_complication_allowed_list_add_delete_p +* @since_tizen 5.0 +* @author SRID(samuel.peter) +* @reviewer SRID(manoj.g2) +* @type auto +* @description Adds and deletes provider info from the allowed list. +* @scenario Adds and deletes provider info from the allowed list. +* @apicovered watchface_complication_allowed_list_add, watchface_complication_allowed_list_delete +* @passcase watchface_complication_allowed_list_add, watchface_complication_allowed_list_delete returns 0 +* @failcase watchface_complication_allowed_list_add, watchface_complication_allowed_list_delete returns 1 +* @precondition N/A +* @postcondition N/A +* */ +int ITc_watchface_complication_allowed_list_add_delete_p(void) +{ + START_TEST; + complication_allowed_list_h hHandle = NULL; + int nRet = 0; + + nRet = watchface_complication_allowed_list_create(&hHandle); + ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_allowed_list_create"); + PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_allowed_list_create", WatchfaceComplicationGetError(nRet)); + CHECK_HANDLE_EXIT(hHandle, "watchface_complication_allowed_list_create"); + + nRet = watchface_complication_allowed_list_add(hHandle, PROVIDER_ID, WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT); + PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_allowed_list_add", WatchfaceComplicationGetError(nRet), watchface_complication_allowed_list_destroy(hHandle)); + + nRet = watchface_complication_allowed_list_delete(hHandle, PROVIDER_ID); + PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_allowed_list_delete", WatchfaceComplicationGetError(nRet), watchface_complication_allowed_list_destroy(hHandle)); + + nRet = watchface_complication_allowed_list_destroy(hHandle); + PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_allowed_list_destroy", WatchfaceComplicationGetError(nRet)); + + service_app_exit(); + return 0; +} + +//& purpose: To get n-th item of the allowed list +//& type: auto +/** +* @testcase ITc_watchface_complication_allowed_list_get_nth_p +* @since_tizen 5.0 +* @author SRID(samuel.peter) +* @reviewer SRID(manoj.g2) +* @type auto +* @description Gets n-th item of the allowed list. +* @scenario Gets n-th item of the allowed list. +* @apicovered watchface_complication_allowed_list_get_nth +* @passcase watchface_complication_allowed_list_get_nth returns 0 +* @failcase watchface_complication_allowed_list_get_nth returns 1 +* @precondition N/A +* @postcondition N/A +* */ +int ITc_watchface_complication_allowed_list_get_nth_p(void) +{ + START_TEST; + complication_allowed_list_h hHandle = NULL; + char *pszProviderId = NULL; + int nIndex = 0; + int nTypes = -1; + int nRet = 0; + + nRet = watchface_complication_allowed_list_create(&hHandle); + ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_allowed_list_create"); + PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_allowed_list_create", WatchfaceComplicationGetError(nRet)); + CHECK_HANDLE_EXIT(hHandle, "watchface_complication_allowed_list_create"); + + nRet = watchface_complication_allowed_list_add(hHandle, PROVIDER_ID, WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT); + PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_allowed_list_add", WatchfaceComplicationGetError(nRet), watchface_complication_allowed_list_destroy(hHandle)); + + nRet = watchface_complication_allowed_list_get_nth(hHandle, nIndex, &pszProviderId, &nTypes); + PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_allowed_list_get_nth", WatchfaceComplicationGetError(nRet), watchface_complication_allowed_list_destroy(hHandle)); + CHECK_HANDLE_EXIT_CLEANUP(pszProviderId, "watchface_complication_allowed_list_get_nth", watchface_complication_allowed_list_destroy(hHandle)); + + if(strncmp(pszProviderId, PROVIDER_ID, strlen(pszProviderId)) != 0) + { + FPRINTF("[Line : %d][%s] %s failed. pszProviderId = %s\\n", __LINE__, API_NAMESPACE, "watchface_complication_allowed_list_get_nth", pszProviderId); + FREE_MEMORY(pszProviderId); + watchface_complication_allowed_list_destroy(hHandle); + return 1; + } + FREE_MEMORY(pszProviderId); + + if( nTypes < 0 ) + { + FPRINTF("[Line : %d][%s] %s failed. nTypes = %d\\n", __LINE__, API_NAMESPACE, "watchface_complication_allowed_list_get_nth", nTypes); + watchface_complication_allowed_list_destroy(hHandle); + return 1; + } + + nRet = watchface_complication_allowed_list_destroy(hHandle); + PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_allowed_list_destroy", WatchfaceComplicationGetError(nRet)); + + service_app_exit(); + return 0; +} + +//& purpose: To apply and clear the allowed list to a complication +//& type: auto +/** +* @testcase ITc_watchface_complication_allowed_list_apply_clear_p +* @since_tizen 5.0 +* @author SRID(samuel.peter) +* @reviewer SRID(manoj.g2) +* @type auto +* @description Applies and clears the allowed list to a complication. +* @scenario Applies and clears the allowed list to a complication. +* @apicovered watchface_complication_allowed_list_apply, watchface_complication_allowed_list_clear +* @passcase watchface_complication_allowed_list_apply, watchface_complication_allowed_list_clear return 0 +* @failcase watchface_complication_allowed_list_apply, watchface_complication_allowed_list_clear return 1 +* @precondition N/A +* @postcondition N/A +* */ +int ITc_watchface_complication_allowed_list_apply_clear_p(void) +{ + START_TEST; + complication_h hHandle = NULL; + complication_allowed_list_h hListHandle = NULL; + + nComplicatoinId++; + int nRet = watchface_complication_create(nComplicatoinId, PROVIDER_ID, WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT, WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT, WATCHFACE_COMPLICATION_EVENT_NONE, &hHandle); + ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_create"); + PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_create", WatchfaceComplicationGetError(nRet)); + CHECK_HANDLE_EXIT(hHandle, "watchface_complication_create"); + + nRet = watchface_complication_allowed_list_create(&hListHandle); + PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_allowed_list_create", WatchfaceComplicationGetError(nRet), watchface_complication_destroy(hHandle)); + CHECK_HANDLE_EXIT_CLEANUP(hListHandle, "watchface_complication_allowed_list_create", watchface_complication_destroy(hHandle)); + + nRet = watchface_complication_allowed_list_add(hListHandle, PROVIDER_ID, WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT); + PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_allowed_list_add", WatchfaceComplicationGetError(nRet), watchface_complication_allowed_list_destroy(hListHandle); watchface_complication_destroy(hHandle)); + + nRet = watchface_complication_allowed_list_apply(hHandle, hListHandle); + PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_allowed_list_apply", WatchfaceComplicationGetError(nRet), watchface_complication_allowed_list_destroy(hListHandle); watchface_complication_destroy(hHandle)); + + nRet = watchface_complication_allowed_list_clear(hHandle); + PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_allowed_list_clear", WatchfaceComplicationGetError(nRet), watchface_complication_allowed_list_destroy(hListHandle); watchface_complication_destroy(hHandle)); + + nRet = watchface_complication_allowed_list_destroy(hListHandle); + PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_allowed_list_destroy", WatchfaceComplicationGetError(nRet), watchface_complication_destroy(hHandle)); + + nRet = watchface_complication_destroy(hHandle); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_destroy", WatchfaceComplicationGetError(nRet)); + + service_app_exit(); + return 0; +} + +//& purpose: To get screen reader text from complication data +//& type: auto +/** +* @testcase ITc_watchface_complication_data_get_screen_reader_text_p +* @since_tizen 5.0 +* @author SRID(samuel.peter) +* @reviewer SRID(manoj.g2) +* @type auto +* @description Gets screen reader text from complication data. +* @scenario Gets screen reader text from complication data. +* @apicovered watchface_complication_data_get_screen_reader_text +* @passcase watchface_complication_data_get_screen_reader_text return 0 +* @failcase watchface_complication_data_get_screen_reader_text return 1 +* @precondition N/A +* @postcondition N/A +* */ +int ITc_watchface_complication_data_get_screen_reader_text_p(void) +{ + START_TEST; + complication_h hHandle = NULL; + nComplicatoinId++; + g_bCallBackHit = false; + + int nRet = watchface_complication_create(nComplicatoinId, PROVIDER_ID, WATCHFACE_COMPLICATION_TYPE_ICON, WATCHFACE_COMPLICATION_TYPE_ICON, + WATCHFACE_COMPLICATION_EVENT_NONE, &hHandle); + ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_create"); + PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_create", WatchfaceComplicationGetError(nRet)); + CHECK_HANDLE_EXIT(hHandle, "watchface_complication_create"); + + nRet = watchface_complication_add_updated_cb(hHandle, ScreenReaderCb, WatchfaceComplicationErrorCb, NULL); + PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_add_updated_cb", WatchfaceComplicationGetError(nRet), watchface_complication_destroy(hHandle)); + + nRet = watchface_complication_send_update_request(hHandle); + PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_send_update_request", WatchfaceComplicationGetError(nRet), watchface_complication_destroy(hHandle)); + + IterateGmainLoop(); + if(!g_bCallBackHit) + { + FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "ScreenReaderCb"); + nRet = watchface_complication_remove_updated_cb(hHandle, RangedValueComplicationUpdatedCb); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_remove_updated_cb", WatchfaceComplicationGetError(nRet)); + nRet = watchface_complication_destroy(hHandle); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_destroy", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 1; + } + + nRet = watchface_complication_remove_updated_cb(hHandle, ScreenReaderCb); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_remove_updated_cb", WatchfaceComplicationGetError(nRet)); + + nRet = watchface_complication_destroy(hHandle); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_destroy", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + + return 0; +} + +//& purpose: To transfer touch event to the complication provider +//& type: auto +/** +* @testcase ITc_watchface_complication_transfer_event_p +* @since_tizen 5.0 +* @author SRID(samuel.peter) +* @reviewer SRID(manoj.g2) +* @type auto +* @description Transfers touch event to the complication provider. +* @scenario Transfers touch event to the complication provider. +* @apicovered watchface_complication_transfer_event +* @passcase watchface_complication_transfer_event return 0 +* @failcase watchface_complication_transfer_event return 1 +* @precondition N/A +* @postcondition N/A +* */ +int ITc_watchface_complication_transfer_event_p(void) +{ + START_TEST; + complication_h hHandle = NULL; + nComplicatoinId++; + + int nRet = watchface_complication_create(nComplicatoinId, PROVIDER_ID, WATCHFACE_COMPLICATION_TYPE_ICON, WATCHFACE_COMPLICATION_TYPE_ICON, + WATCHFACE_COMPLICATION_EVENT_NONE, &hHandle); + ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_create"); + PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_create", WatchfaceComplicationGetError(nRet)); + CHECK_HANDLE_EXIT(hHandle, "watchface_complication_create"); + + nRet = watchface_complication_add_updated_cb(hHandle, ScreenReaderCb, WatchfaceComplicationErrorCb, NULL); + PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_add_updated_cb", WatchfaceComplicationGetError(nRet), watchface_complication_destroy(hHandle)); + + nRet = watchface_complication_transfer_event(hHandle, WATCHFACE_COMPLICATION_EVENT_TAP); + PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_transfer_event", WatchfaceComplicationGetError(nRet), watchface_complication_destroy(hHandle)); + + nRet = watchface_complication_remove_updated_cb(hHandle, ScreenReaderCb); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_remove_updated_cb", WatchfaceComplicationGetError(nRet)); + + nRet = watchface_complication_destroy(hHandle); + PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_destroy", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 0; +} + diff --git a/src/itc/watchface-complication/ITs-watchface-editable.c b/src/itc/watchface-complication/ITs-watchface-editable.c new file mode 100755 index 000000000..bd6ce18a8 --- /dev/null +++ b/src/itc/watchface-complication/ITs-watchface-editable.c @@ -0,0 +1,1364 @@ +// +// Copyright (c) 2019 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 "ITs-watchface-common.h" +#include +#define PROVIDER_ID "org.tizen.watchface_sample_provider/test" +#define EDITOR_ID "org.tizen.watchface_sample_editor" +#define MAX_COUNTER 5 +#define GEO_X 100 +#define GEO_Y 100 +#define GEO_W 100 +#define GEO_H 100 + +/** @addtogroup itc-watchface +* @ingroup itc +* @{ +*/ + +//& set: watchface + +/** +* @function ITs_watchface_editable_startup +* @description Called before each test, set the service boolean true +* @parameter NA +* @nReturn NA +*/ +void ITs_watchface_editable_startup(void) +{ +#if DEBUG + FPRINTF("[Line : %d][%s] TEST SUIT start-up: ITs_Watchface_Editable_p\\n", __LINE__, API_NAMESPACE); +#endif + g_bWatchApp = TCTCheckSystemInfoFeatureSupported(FEATURE_WATCH_APP, API_NAMESPACE); + g_bFeatureNotSupported = false; + g_bIsFeatureMismatched = false; + return; +} + +/** +* @function ITs_watchface_editable_cleanup +* @description Called after each test +* @parameter NA +* @nReturn NA +*/ +void ITs_watchface_editable_cleanup(void) +{ +#if DEBUG + FPRINTF("[Line : %d][%s] TEST SUIT clean-up: ITs_Watchface_Editable_p\\n", __LINE__, API_NAMESPACE); +#endif + return; +} + + +/****************************************************Callback Start****************************************************/ +/** +* @function RunEditorApp +* @description Helper Function +* @parameters N/A +* @return N/A +*/ +static void RunEditorApp() +{ + FPRINTF("[Line : %d][%s] entered %s.\\n", __LINE__, API_NAMESPACE, "RunEditorApp"); + + static app_control_h hAppControl; + bool bIsRunning = false; + int nCounter = MAX_COUNTER; + int nRet; + + nRet = app_control_create(&hAppControl); + if(nRet != APP_CONTROL_ERROR_NONE) + { + FPRINTF("[Line : %d][%s] app_control_create returned %s error\\n", __LINE__, API_NAMESPACE, AppControlGetError(nRet)); + return; + } + if(hAppControl == NULL) + { + FPRINTF("[Line : %d][%s] %s failed, error returned = Handle returned is NULL\\n", __LINE__, API_NAMESPACE, "app_control_create"); + return; + } + + nRet = app_control_set_app_id(hAppControl, EDITOR_ID); + if(nRet != APP_CONTROL_ERROR_NONE) + { + FPRINTF("[Line : %d][%s] app_control_set_app_id returned %s error\\n", __LINE__, API_NAMESPACE, AppControlGetError(nRet)); + app_control_destroy(hAppControl); + return; + } + + nRet = app_control_add_extra_data(hAppControl, "SENDER_ID", "org.tizen.watchface-complication-native-itc"); + if(nRet != APP_CONTROL_ERROR_NONE) + { + FPRINTF("[Line : %d][%s] app_control_add_extra_data returned %s error\\n", __LINE__, API_NAMESPACE, AppControlGetError(nRet)); + app_control_destroy(hAppControl); + return; + } + do { + nRet = app_control_send_launch_request(hAppControl, NULL, NULL); + if (nRet != APP_CONTROL_ERROR_NONE) + sleep(1); + app_manager_is_running(EDITOR_ID, &bIsRunning); + } while (--nCounter > 0 && !bIsRunning); + sleep(1); + + return; +} + + +/** +* @function RequestEditWithDesignElements +* @description Helper Function +* @parameters hEdCon, updateCb +* @return 0, 1 +*/ +static int RequestEditWithDesignElements(watchface_editable_container_h hEdCon, watchface_editable_update_requested_cb updateCb) +{ + FPRINTF("[Line : %d][%s] entered %s.\\n", __LINE__, API_NAMESPACE, "RequestEditWithDesignElements"); + int nRet; + complication_candidates_list_h hListHandle = NULL; + bundle *candidate1; + bundle *candidate2; + watchface_editable_highlight_h hHighlight = NULL; + + nRet = watchface_editable_candidates_list_create(&hListHandle); + ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_editable_candidates_list_create"); + PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_candidates_list_create", WatchfaceComplicationGetError(nRet)); + CHECK_HANDLE_EXIT(hListHandle, "watchface_editable_candidates_list_create"); + + candidate1 = bundle_create(); + nRet = get_last_result(); + PRINT_RESULT_EXIT_CLEANUP(nRet, BUNDLE_ERROR_NONE, "bundle_create", BundleGetError(nRet), watchface_editable_candidates_list_destroy(hListHandle)); + CHECK_HANDLE_EXIT_CLEANUP(candidate1, "bundle_create", watchface_editable_candidates_list_destroy(hListHandle)); + bundle_add_str(candidate1, "COLOR", "RED"); + nRet = watchface_editable_candidates_list_add(hListHandle, candidate1); + PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_candidates_list_add", WatchfaceComplicationGetError(nRet), watchface_editable_candidates_list_destroy(hListHandle); bundle_free(candidate1)); + + candidate2 = bundle_create(); + nRet = get_last_result(); + PRINT_RESULT_EXIT_CLEANUP(nRet, BUNDLE_ERROR_NONE, "bundle_create", BundleGetError(nRet), watchface_editable_candidates_list_destroy(hListHandle);bundle_free(candidate1)); + CHECK_HANDLE_EXIT_CLEANUP(candidate2, "bundle_create", watchface_editable_candidates_list_destroy(hListHandle); bundle_free(candidate1)); + bundle_add_str(candidate2, "COLOR", "BLUE"); + nRet = watchface_editable_candidates_list_add(hListHandle, candidate2); + PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_candidates_list_add", WatchfaceComplicationGetError(nRet), watchface_editable_candidates_list_destroy(hListHandle); bundle_free(candidate1); bundle_free(candidate2)); + + nRet = watchface_editable_highlight_create(&hHighlight, WATCHFACE_EDITABLE_SHAPE_TYPE_CIRCLE); + PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_highlight_create", WatchfaceComplicationGetError(nRet), watchface_editable_candidates_list_destroy(hListHandle); bundle_free(candidate1); bundle_free(candidate2)); + CHECK_HANDLE_EXIT_CLEANUP(hHighlight, "watchface_editable_highlight_create", watchface_editable_candidates_list_destroy(hListHandle); bundle_free(candidate1); bundle_free(candidate2)); + + nRet = watchface_editable_highlight_set_geometry(hHighlight, GEO_X, GEO_Y, GEO_W, GEO_H); + PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_highlight_set_geometry", WatchfaceComplicationGetError(nRet), bundle_free(candidate1); bundle_free(candidate2); watchface_editable_candidates_list_destroy(hListHandle); watchface_editable_highlight_destroy(hHighlight)); + + nRet = watchface_editable_add_design_element(hEdCon, 0, 0, hListHandle, hHighlight, "Color"); + PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_add_design_element", WatchfaceComplicationGetError(nRet), bundle_free(candidate1); bundle_free(candidate2); watchface_editable_candidates_list_destroy(hListHandle); watchface_editable_highlight_destroy(hHighlight)); + + nRet = watchface_editable_request_edit(hEdCon, updateCb, NULL); + PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_request_edit", WatchfaceComplicationGetError(nRet), bundle_free(candidate1); bundle_free(candidate2); watchface_editable_candidates_list_destroy(hListHandle); watchface_editable_highlight_destroy(hHighlight)); + + bundle_free(candidate1); + bundle_free(candidate2); + watchface_editable_highlight_destroy(hHighlight); + watchface_editable_candidates_list_destroy(hListHandle); + + return nRet; +} + + +/** +* @function RequestEditWithComplicationCb +* @description Callback Function +* @parameters hHandle, nSelectedIdx, eState, pszUserData +* @return NA +*/ +static void RequestEditWithComplicationCb(const watchface_editable_h hHandle, int nSelectedIdx, const watchface_editable_edit_state_e eState, void *pszUserData) +{ + FPRINTF("[Line : %d][%s] entered %s.\\n", __LINE__, API_NAMESPACE, "RequestEditWithComplicationCb"); + g_bCallBackHit = true; + service_app_exit(); + return; +} + +/** +* @function AddComplicationOnEditReadyCb +* @description Callback Function +* @parameters hEdCon, pszEditorAppid, pszUserData +* @return NA +*/ +static void AddComplicationOnEditReadyCb(watchface_editable_container_h hEdCon,const char *pszEditorAppid,void *pszUserData) +{ + FPRINTF("[Line : %d][%s] entered %s.\\n", __LINE__, API_NAMESPACE, "AddComplicationOnEditReadyCb"); + int nRet; + int nEditableId = 1; + complication_h hHandle = NULL; + watchface_editable_highlight_h hHighlight = NULL; + char *pszXUserData = (char *)pszUserData; + + if(strncmp(pszXUserData, g_pszCheckUserData, strlen(g_pszCheckUserData)) != 0){ + service_app_exit(); + return; + } + nRet = watchface_editable_highlight_create(&hHighlight, WATCHFACE_EDITABLE_SHAPE_TYPE_CIRCLE); + CALLBACK_ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_editable_highlight_create"); + CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_highlight_create", WatchfaceComplicationGetError(nRet)); + CALLBACK_CHECK_HANDLE_EXIT_CLEANUP(hHighlight, "watchface_complication_create", watchface_editable_highlight_destroy(hHighlight)); + + nRet = watchface_editable_highlight_set_geometry(hHighlight, GEO_X, GEO_Y, GEO_W, GEO_H); + CALLBACK_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_highlight_set_geometry", WatchfaceComplicationGetError(nRet), watchface_editable_highlight_destroy(hHighlight)); + + nRet = watchface_complication_create(1, PROVIDER_ID, WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT, WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT, WATCHFACE_COMPLICATION_EVENT_TAP, &hHandle); + CALLBACK_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_create", WatchfaceComplicationGetError(nRet), watchface_editable_highlight_destroy(hHighlight)); + CALLBACK_CHECK_HANDLE_EXIT_CLEANUP(hHandle, "watchface_complication_create", watchface_editable_highlight_destroy(hHighlight)); + + nRet = watchface_editable_add_complication(hEdCon, pszEditorAppid, hHandle, hHighlight); + CALLBACK_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_add_complication", WatchfaceComplicationGetError(nRet), watchface_editable_highlight_destroy(hHighlight);watchface_complication_destroy(hHandle)); + + nRet = watchface_editable_request_edit(hEdCon, RequestEditWithComplicationCb, g_pszCheckUserData); + CALLBACK_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_request_edit", WatchfaceComplicationGetError(nRet), watchface_editable_highlight_destroy(hHighlight);watchface_complication_destroy(hHandle)); + + watchface_editable_highlight_destroy(hHighlight); + watchface_complication_destroy(hHandle); + g_bCallBackHit = true; + service_app_exit(); + return; +} + +/** +* @function GetNthUpdateRequestedCb +* @description Callback Function +* @parameters hHandle, nSelectedIdx, eState, pszUserData +* @return NA +*/ +static void GetNthUpdateRequestedCb(const watchface_editable_h hHandle, int nSelectedIdx, const watchface_editable_edit_state_e eState, void *pszUserData) +{ + FPRINTF("[Line : %d][%s] entered %s.\\n", __LINE__, API_NAMESPACE, "GetNthUpdateRequestedCb"); + int nRet; + int n = 0; + bundle *pszNthData = NULL; + + nRet = watchface_editable_get_nth_data(hHandle, n, &pszNthData); + CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_get_nth_data", WatchfaceComplicationGetError(nRet)); + CALLBACK_CHECK_HANDLE_EXIT(pszNthData, "watchface_editable_get_nth_data"); + bundle_free(pszNthData); + g_bCallBackHit = true; + service_app_exit(); + return; +} + +/** +* @function GetNthOnEditReadyCb +* @description Callback Function +* @parameters hEdCon, pszEditorAppid, pszUserData +* @return NA +*/ +static void GetNthOnEditReadyCb(watchface_editable_container_h hEdCon, const char *pszEditorAppid, void *pszUserData) +{ + FPRINTF("[Line : %d][%s] entered %s.\\n", __LINE__, API_NAMESPACE, "GetNthOnEditReadyCb"); + int nRet = RequestEditWithDesignElements(hEdCon, GetNthUpdateRequestedCb); + if(g_bFeatureNotSupported || g_bIsFeatureMismatched) + return; + CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "RequestEditWithDesignElements", WatchfaceComplicationGetError(nRet)); + return; +} + +/** +* @function UpdateRequestedCb +* @description Callback Function +* @parameters hHandle, nSelectedIdx, eState, pszUserData +* @return NA +*/ +static void UpdateRequestedCb(const watchface_editable_h hHandle,int nSelectedIdx,const watchface_editable_edit_state_e eState,void *pszUserData) +{ + FPRINTF("[Line : %d][%s] entered %s.\\n", __LINE__, API_NAMESPACE, "UpdateRequestedCb"); + g_bCallBackHit = true; + service_app_exit(); + return; +} + +/** +* @function DesignElementOnEditReadyCb +* @description Callback Function +* @parameters hEdCon, pszEditorAppid, pszUserData +* @return NA +*/ +static void DesignElementOnEditReadyCb(watchface_editable_container_h hEdCon,const char *pszEditorAppId,void *pszUserData) +{ + FPRINTF("[Line : %d][%s] entered %s.\\n", __LINE__, API_NAMESPACE, "DesignElementOnEditReadyCb"); + int nRet; + nRet = RequestEditWithDesignElements(hEdCon, UpdateRequestedCb); + if(g_bFeatureNotSupported || g_bIsFeatureMismatched) + return; + CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "RequestEditWithDesignElements", WatchfaceComplicationGetError(nRet)); + g_bCallBackHit = true; + return; +} + +/** +* @function RequestEditOnEditReadyCb +* @description Callback Function +* @parameters hEdCon, pszEditorAppid, pszUserData +* @return NA +*/ +static void RequestEditOnEditReadyCb(watchface_editable_container_h hEdCon,const char *pszEditorAppid,void *pszUserData) +{ + FPRINTF("[Line : %d][%s] entered %s.\\n", __LINE__, API_NAMESPACE, "RequestEditOnEditReadyCb"); + int nRet; + complication_h hHandle = NULL; + watchface_editable_highlight_h hHighlight = NULL; + + nRet = watchface_editable_highlight_create(&hHighlight,WATCHFACE_EDITABLE_SHAPE_TYPE_CIRCLE); + CALLBACK_ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_editable_highlight_create"); + CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_highlight_create", WatchfaceComplicationGetError(nRet)); + CALLBACK_CHECK_HANDLE_EXIT(hHighlight, "watchface_editable_highlight_create"); + + nRet = watchface_editable_highlight_set_geometry(hHighlight, GEO_X, GEO_Y, GEO_W, GEO_H); + CALLBACK_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_highlight_set_geometry", WatchfaceComplicationGetError(nRet), watchface_editable_highlight_destroy(hHighlight)); + + nRet = watchface_complication_create(0, "org.tizen.sample_provider", WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT, WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT, WATCHFACE_COMPLICATION_EVENT_TAP, &hHandle); + CALLBACK_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_create", WatchfaceComplicationGetError(nRet), watchface_editable_highlight_destroy(hHighlight)); + CALLBACK_CHECK_HANDLE_EXIT_CLEANUP(hHandle, "watchface_complication_create", watchface_editable_highlight_destroy(hHighlight)); + + nRet = watchface_editable_add_complication(hEdCon, 0, hHandle, hHighlight); + CALLBACK_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_add_complication", WatchfaceComplicationGetError(nRet), watchface_editable_highlight_destroy(hHighlight);watchface_complication_destroy(hHandle)); + + nRet = watchface_editable_request_edit(hEdCon, UpdateRequestedCb, NULL); + CALLBACK_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_request_edit", WatchfaceComplicationGetError(nRet), watchface_editable_highlight_destroy(hHighlight);watchface_complication_destroy(hHandle)); + + watchface_editable_highlight_destroy(hHighlight); + watchface_complication_destroy(hHandle); + g_bCallBackHit = true; + service_app_exit(); + return; +} + +/** +* @function WatchfaceEditableEditReadyCb +* @description Callback Function +* @parameters hEdCon, pszEditorAppid, pszUserData +* @return NA +*/ +static void WatchfaceEditableEditReadyCb(watchface_editable_container_h hEdCon, const char *pszEditorAppid, void *pszUserData) +{ + FPRINTF("[Line : %d][%s] entered %s.\\n", __LINE__, API_NAMESPACE, "WatchfaceEditableEditReadyCb"); + g_bCallBackHit = true; + return; +} + +/** +* @function GetCurDataUpdateRequestedCb +* @description Callback Function +* @parameters hHandle, nSelectedIdx, eState, pszUserData +* @return NA +*/ +static void GetCurDataUpdateRequestedCb(const watchface_editable_h hHandle, int nSelectedIdx, const watchface_editable_edit_state_e eState, void *pszUserData) { + + FPRINTF("[Line : %d][%s] entered %s.\\n", __LINE__, API_NAMESPACE, "GetCurDataUpdateRequestedCb"); + bundle *pszCurrData = NULL; + + int nRet = watchface_editable_get_current_data(hHandle, &pszCurrData); + CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_get_current_data", WatchfaceComplicationGetError(nRet)); + CALLBACK_CHECK_HANDLE_EXIT(pszCurrData, "watchface_editable_get_current_data"); + + bundle_free(pszCurrData); + g_bCallBackHit = true; + return; +} + +/** +* @function GetCurDataOnEditReadyCb +* @description Callback Function +* @parameters hEdCon, pszEditorAppid, pszUserData +* @return NA +*/ +static void GetCurDataOnEditReadyCb(watchface_editable_container_h hEdCon, const char *pszEditorAppid, void *pszUserData) { + + FPRINTF("[Line : %d][%s] entered %s.\\n", __LINE__, API_NAMESPACE, "GetCurDataOnEditReadyCb"); + int nRet = RequestEditWithDesignElements(hEdCon, GetCurDataUpdateRequestedCb); + if(g_bFeatureNotSupported || g_bIsFeatureMismatched) + return; + CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "RequestEditWithDesignElements", WatchfaceComplicationGetError(nRet)); + g_bCallBackHit = true; + return; +} + +/** +* @function GetCurDataIdxUpdateRequestedCb +* @description Callback Function +* @parameters hHandle, nSelectedIdx, eState, pszUserData +* @return NA +*/ +static void GetCurDataIdxUpdateRequestedCb(const watchface_editable_h hHandle, int nSelectedIdx, const watchface_editable_edit_state_e eState, void *pszUserData) +{ + FPRINTF("[Line : %d][%s] entered %s.\\n", __LINE__, API_NAMESPACE, "GetCurDataIdxUpdateRequestedCb"); + int nRet; + int nIdx = -1; + + nRet = watchface_editable_get_current_data_idx(hHandle, &nIdx); + CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_get_current_data_idx", WatchfaceComplicationGetError(nRet)); + if(nIdx < 0) + { + FPRINTF("[Line : %d][%s] %s failed. nIdx = %d\\n", __LINE__, API_NAMESPACE, "watchface_editable_get_current_data_idx", nIdx); + service_app_exit(); + return; + } + + g_bCallBackHit = true; + service_app_exit(); + return; +} + +/** +* @function GetCurDataIdxOnEditReadyCb +* @description Callback Function +* @parameters hEdCon, pszEditorAppid, pszUserData +* @return NA +*/ +static void GetCurDataIdxOnEditReadyCb(watchface_editable_container_h hEdCon, const char *pszEditorAppid, void *pszUserData) { + + FPRINTF("[Line : %d][%s] entered %s.\\n", __LINE__, API_NAMESPACE, "GetCurDataIdxOnEditReadyCb"); + int nRet = RequestEditWithDesignElements(hEdCon, GetCurDataIdxUpdateRequestedCb); + if(g_bFeatureNotSupported || g_bIsFeatureMismatched) + return; + CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "RequestEditWithDesignElements", WatchfaceComplicationGetError(nRet)); + return; +} + +/** +* @function GetEditableIdUpdateRequestedCb +* @description Callback Function +* @parameters hHandle, nSelectedIdx, eState, pszUserData +* @return NA +*/ +static void GetEditableIdUpdateRequestedCb(const watchface_editable_h hHandle, int nSelectedIdx, const watchface_editable_edit_state_e eState, void *pszUserData){ + + FPRINTF("[Line : %d][%s] entered %s.\\n", __LINE__, API_NAMESPACE, "GetEditableIdUpdateRequestedCb"); + int nEditableId = -1; + int nRet = watchface_editable_get_editable_id(hHandle, &nEditableId); + CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_get_editable_id", WatchfaceComplicationGetError(nRet)); + if(nEditableId < 0) + { + FPRINTF("[Line : %d][%s] %s failed. nEditableId = %d\\n", __LINE__, API_NAMESPACE, "watchface_editable_get_editable_id", nEditableId); + service_app_exit(); + return; + } + g_bCallBackHit = true; + service_app_exit(); + return; +} + +/** +* @function GetEditableIdOnEditReadyCb +* @description Callback Function +* @parameters hEdCon, pszEditorAppid, pszUserData +* @return NA +*/ +static void GetEditableIdOnEditReadyCb(watchface_editable_container_h hEdCon, const char *pszEditorAppid, void *pszUserData) { + + FPRINTF("[Line : %d][%s] entered %s.\\n", __LINE__, API_NAMESPACE, "GetEditableIdOnEditReadyCb"); + int nRet = RequestEditWithDesignElements(hEdCon, GetEditableIdUpdateRequestedCb); + if(g_bFeatureNotSupported || g_bIsFeatureMismatched) + return; + CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "RequestEditWithDesignElements", WatchfaceComplicationGetError(nRet)); + return; +} + +/** +* @function LoadCurrentDataUpdateRequestedCb +* @description Callback Function +* @parameters hHandle, nSelectedIdx, eState, pszUserData +* @return NA +*/ +static void LoadCurrentDataUpdateRequestedCb(const watchface_editable_h hHandle,int nSelectedIdx,const watchface_editable_edit_state_e eState,void *pszUserData) +{ + FPRINTF("[Line : %d][%s] entered %s.\\n", __LINE__, API_NAMESPACE, "LoadCurrentDataUpdateRequestedCb"); + int nEditableId = -1; + int nRet; + bundle *pszCurrentData = NULL; + + if(eState == WATCHFACE_EDITABLE_EDIT_STATE_COMPLETE){ + nRet = watchface_editable_get_editable_id(hHandle, &nEditableId); + CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_get_editable_id", WatchfaceComplicationGetError(nRet)); + if(nEditableId < 0) + { + FPRINTF("[Line : %d][%s] %s failed. nEditableId = %d\\n", __LINE__, API_NAMESPACE, "watchface_editable_get_editable_id", nEditableId); + service_app_exit(); + return; + } + nRet = watchface_editable_load_current_data(nEditableId, &pszCurrentData); + CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_load_current_data", WatchfaceComplicationGetError(nRet)); + CALLBACK_CHECK_HANDLE_EXIT(pszCurrentData, "watchface_editable_load_current_data"); + FREE_MEMORY(pszCurrentData); + g_bCallBackHit = true; + } + service_app_exit(); + return; +} + +/** +* @function LoadCurrentDataOnEditReadyCb +* @description Callback Function +* @parameters hEdCon, pszEditorAppid, pszUserData +* @return NA +*/ +static void LoadCurrentDataOnEditReadyCb(watchface_editable_container_h hEdCon,const char *pszEditorAppid,void *pszUserData) { + + FPRINTF("[Line : %d][%s] entered %s.\\n", __LINE__, API_NAMESPACE, "LoadCurrentDataOnEditReadyCb"); + int nRet = RequestEditWithDesignElements(hEdCon, LoadCurrentDataUpdateRequestedCb); + if(g_bFeatureNotSupported || g_bIsFeatureMismatched) + return; + CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "RequestEditWithDesignElements", WatchfaceComplicationGetError(nRet)); + return; +} + +/** +* @function EditableSetNameUpdateRequestedCb +* @description Callback Function +* @parameters hHandle, nSelectedIdx, eState, pszUserData +* @return NA +*/ +static void EditableSetNameUpdateRequestedCb(const watchface_editable_h hHandle,int nSelectedIdx,const watchface_editable_edit_state_e eState,void *pszUserData) +{ + FPRINTF("[Line : %d][%s] entered %s.\\n", __LINE__, API_NAMESPACE, "EditableSetNameUpdateRequestedCb"); + int nRet = watchface_editable_set_editable_name(hHandle, pszEditableSetName); + CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_set_editable_name", WatchfaceComplicationGetError(nRet)); + g_bCallBackHit = true; + service_app_exit(); + return; +} + +/** +* @function EditableSetNameOnEditReadyCb +* @description Callback Function +* @parameters hEdCon, pszEditorAppid, pszUserData +* @return NA +*/ +static void EditableSetNameOnEditReadyCb(watchface_editable_container_h hEdCon,const char *pszEditorAppid,void *pszUserData) { + + FPRINTF("[Line : %d][%s] entered %s.\\n", __LINE__, API_NAMESPACE, "EditableSetNameOnEditReadyCb"); + int nRet = RequestEditWithDesignElements(hEdCon, EditableSetNameUpdateRequestedCb); + if(g_bFeatureNotSupported || g_bIsFeatureMismatched) + return; + CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "RequestEditWithDesignElements", WatchfaceComplicationGetError(nRet)); + return; +} + +/** +* @function EditableGetNameUpdateRequestedCb +* @description Callback Function +* @parameters hHandle, nSelectedIdx, eState, pszUserData +* @return NA +*/ +static void EditableGetNameUpdateRequestedCb(const watchface_editable_h hHandle,int nSelectedIdx,const watchface_editable_edit_state_e eState,void *pszUserData) { + + FPRINTF("[Line : %d][%s] entered %s.\\n", __LINE__, API_NAMESPACE, "EditableGetNameUpdateRequestedCb"); + int nRet = watchface_editable_set_editable_name(hHandle, pszEditableSetName); + CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_set_editable_name", WatchfaceComplicationGetError(nRet)); + + nRet = watchface_editable_get_editable_name(hHandle, &g_pszEditableGetName); + CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_get_editable_name", WatchfaceComplicationGetError(nRet)); + CALLBACK_CHECK_HANDLE_EXIT(g_pszEditableGetName, "watchface_editable_get_editable_name"); + + g_bCallBackHit = true; + service_app_exit(); + return; +} + +/** +* @function EditableGetNameOnEditReadyCb +* @description Callback Function +* @parameters hEdCon, pszEditorAppid, pszUserData +* @return NA +*/ +static void EditableGetNameOnEditReadyCb(watchface_editable_container_h hEdCon,const char *pszEditorAppid,void *pszUserData) { + + FPRINTF("[Line : %d][%s] entered %s.\\n", __LINE__, API_NAMESPACE, "EditableGetNameOnEditReadyCb"); + int nRet = RequestEditWithDesignElements(hEdCon, EditableGetNameUpdateRequestedCb); + if(g_bFeatureNotSupported || g_bIsFeatureMismatched) + return; + CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "RequestEditWithDesignElements", WatchfaceComplicationGetError(nRet)); + return; +} + +/** +* @function GetHighlightUpdateRequestedCb +* @description Callback Function +* @parameters hHandle, nSelectedIdx, eState, pszUserData +* @return NA +*/ +static void GetHighlightUpdateRequestedCb(const watchface_editable_h hHandle, int nSelectedIdx, const watchface_editable_edit_state_e eState, void *pszUserData) { + + FPRINTF("[Line : %d][%s] entered %s.\\n", __LINE__, API_NAMESPACE, "GetHighlightUpdateRequestedCb"); + watchface_editable_highlight_h highlight; + int nX; + int nY; + int nW; + int nH; + + int nRet = watchface_editable_get_highlight(hHandle, &highlight); + CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_get_highlight", WatchfaceComplicationGetError(nRet)); + CALLBACK_CHECK_HANDLE_EXIT(highlight, "watchface_editable_get_highlight"); + + nRet = watchface_editable_highlight_get_geometry(highlight, &nX, &nY, &nW, &nH); + CALLBACK_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_highlight_get_geometry", WatchfaceComplicationGetError(nRet), watchface_editable_highlight_destroy(highlight)); + + if( nX != GEO_X || nY != GEO_Y || nW != GEO_W || nH != GEO_H) + { + FPRINTF("[Line : %d][%s] %s failed. \\nnX = %d\\nnY = %d\\nnW = %d\\nnH = %d\\n", __LINE__, API_NAMESPACE, "watchface_editable_highlight_get_geometry", nX, nY, nH, nW); + watchface_editable_highlight_destroy(highlight); + service_app_exit(); + return; + } + + watchface_editable_highlight_destroy(highlight); + g_bCallBackHit = true; + service_app_exit(); + return; +} + +/** +* @function GetHighlightOnEditReadyCb +* @description Callback Function +* @parameters hEdCon, pszEditorAppid, pszUserData +* @return NA +*/ +static void GetHighlightOnEditReadyCb(watchface_editable_container_h hEdCon, const char *pszEditorAppid, void *pszUserData) +{ + FPRINTF("[Line : %d][%s] entered %s.\\n", __LINE__, API_NAMESPACE, "GetHighlightOnEditReadyCb"); + int nRet = RequestEditWithDesignElements(hEdCon, GetHighlightUpdateRequestedCb); + if(g_bFeatureNotSupported || g_bIsFeatureMismatched) + return; + CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "RequestEditWithDesignElements", WatchfaceComplicationGetError(nRet)); + return; +} + +/*****************************************************Callback End*****************************************************/ + +//& purpose: To create candidate list and adds candidate data to the candidate list and destroy candidates list +//& type: auto +/** +* @testcase ITc_watchface_editable_candidates_list_create_add_destroy_p +* @since_tizen 5.0 +* @author SRID(p.chauhan) +* @reviewer SRID(manoj.g2) +* @type auto +* @description Creates candidates list, Adds candidate data to the candidates list and Destroys candidates list. +* @scenario Creates candidates list, Adds candidate data to the candidates list and Destroys candidates list. +* @apicovered watchface_editable_candidates_list_create, watchface_editable_candidates_list_add, watchface_editable_candidates_list_destroy +* @passcase Target APIs return 0 +* @failcase Target APIs return 1 +* @precondition N/A +* @postcondition N/A +* */ +int ITc_watchface_editable_candidates_list_create_add_destroy_p(void) +{ + START_TEST; + complication_candidates_list_h hHandle = NULL; + bundle *pszCandidate = NULL; + + int nRet = watchface_editable_candidates_list_create(&hHandle); + ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_editable_candidates_list_create"); + PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_candidates_list_create", WatchfaceComplicationGetError(nRet)); + CHECK_HANDLE_EXIT(hHandle, "watchface_editable_candidates_list_create"); + + pszCandidate = bundle_create(); + nRet = get_last_result(); + PRINT_RESULT_EXIT_CLEANUP(nRet, BUNDLE_ERROR_NONE, "bundle_create", BundleGetError(nRet), watchface_editable_candidates_list_destroy(hHandle)); + CHECK_HANDLE_EXIT_CLEANUP(pszCandidate, "bundle_create", watchface_editable_candidates_list_destroy(hHandle)); + bundle_add_str(pszCandidate, "COLOR", "RED"); + nRet = watchface_editable_candidates_list_add(hHandle, pszCandidate); + PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_candidates_list_add", WatchfaceComplicationGetError(nRet), watchface_editable_candidates_list_destroy(hHandle)); + CHECK_HANDLE_EXIT_CLEANUP(pszCandidate, "watchface_editable_candidates_list_add", watchface_editable_candidates_list_destroy(hHandle)); + bundle_free(pszCandidate); + + nRet = watchface_editable_candidates_list_destroy(hHandle); + PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_candidates_list_destroy", WatchfaceComplicationGetError(nRet)); + + service_app_exit(); + return 0; +} + +//& purpose: To add complication to editable container +//& type: auto +/** +* @testcase ITc_watchface_editable_add_complication_p +* @since_tizen 5.0 +* @author SRID(p.chauhan) +* @reviewer SRID(manoj.g2) +* @type auto +* @description Adds complication to editable container. +* @scenario Adds complication to editable container. +* @apicovered watchface_editable_highlight_create, watchface_editable_highlight_set_geometry, watchface_complication_create, watchface_editable_add_complication, watchface_editable_request_edit +* @passcase Target APIs return 0 +* @failcase Target APIs return 1 +* @precondition Editable handle should be created by watchface_editable_highlight_create(). +* @postcondition N/A +* */ +int ITc_watchface_editable_add_complication_p(void) +{ + START_TEST; + int nRet = watchface_editable_add_edit_ready_cb(AddComplicationOnEditReadyCb, g_pszCheckUserData); + if(g_bFeatureNotSupported) + return 0; + if(g_bIsFeatureMismatched) + return 1; + PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_add_edit_ready_cb", WatchfaceComplicationGetError(nRet)); + + g_bCallBackHit = false; + RunEditorApp(); + IterateGmainLoop(); + + if(!g_bCallBackHit) + { + FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "RequestEditWithComplicationCb"); + nRet = watchface_editable_remove_edit_ready_cb(AddComplicationOnEditReadyCb); + PRINT_RESULT_EXIT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); + return 1; + } + nRet = watchface_editable_remove_edit_ready_cb(AddComplicationOnEditReadyCb); + PRINT_RESULT_EXIT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 0; +} + +//& purpose: To get the nth data of the editable +//& type: auto +/** +* @testcase ITc_watchface_editable_get_nth_data_p +* @since_tizen 5.0 +* @author SRID(p.chauhan) +* @reviewer SRID(manoj.g2) +* @type auto +* @description Gets the nth data of the editable. +* @scenario Gets the nth data of the editable. +* @apicovered watchface_editable_get_nth_data +* @passcase watchface_editable_get_nth_data returns 0 +* @failcase watchface_editable_get_nth_data returns 1 +* @precondition N/A +* @postcondition N/A +* */ +int ITc_watchface_editable_get_nth_data_p(void) +{ + START_TEST; + int nRet = 0; + g_bCallBackHit = false; + nRet = watchface_editable_add_edit_ready_cb(GetNthOnEditReadyCb, NULL); + if(g_bFeatureNotSupported) + return 0; + if(g_bIsFeatureMismatched) + return 1; + PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_add_edit_ready_cb", WatchfaceComplicationGetError(nRet)); + + RunEditorApp(); + IterateGmainLoop(); + + if(!g_bCallBackHit) + { + FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "GetNthUpdateRequestedCb"); + nRet = watchface_editable_remove_edit_ready_cb(GetNthOnEditReadyCb); + PRINT_RESULT_EXIT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); + return 1; + } + nRet = watchface_editable_remove_edit_ready_cb(GetNthOnEditReadyCb); + PRINT_RESULT_EXIT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 0; +} + +//& purpose: To add the design element to the editable container handle +//& type: auto +/** +* @testcase ITc_watchface_editable_add_design_element_p +* @since_tizen 5.0 +* @author SRID(p.chauhan) +* @reviewer SRID(manoj.g2) +* @type auto +* @description Adds the design element to the editable container handle. +* @scenario Adds the design element to the editable container handle. +* @apicovered watchface_editable_add_design_element +* @passcase returns 0 +* @failcase returns 1 +* @precondition N/A +* @postcondition N/A +* */ +int ITc_watchface_editable_add_design_element_p(void) +{ + START_TEST; + g_bCallBackHit = false; + int nRet = watchface_editable_add_edit_ready_cb(DesignElementOnEditReadyCb, NULL); + if(g_bFeatureNotSupported) + return 0; + if(g_bIsFeatureMismatched) + return 1; + PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_add_edit_ready_cb", WatchfaceComplicationGetError(nRet)); + + RunEditorApp(); + IterateGmainLoop(); + + if(!g_bCallBackHit) + { + FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "UpdateRequestedCb"); + nRet = watchface_editable_remove_edit_ready_cb(DesignElementOnEditReadyCb); + PRINT_RESULT_EXIT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 1; + } + nRet = watchface_editable_remove_edit_ready_cb(DesignElementOnEditReadyCb); + PRINT_RESULT_EXIT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 0; +} + +//& purpose: To request editor to edit +//& type: auto +/** +* @testcase ITc_watchface_editable_request_edit_p +* @since_tizen 5.0 +* @author SRID(p.chauhan) +* @reviewer SRID(manoj.g2) +* @type auto +* @description Requests editor to edit. +* @scenario Requests editor to edit. +* @apicovered watchface_editable_request_edit +* @passcase Target APIs return 0 +* @failcase Target APIs return 1 +* @precondition Editable handle should be created by watchface_editable_highlight_create(). +* @postcondition N/A +* */ +int ITc_watchface_editable_request_edit_p(void) +{ + START_TEST; + int nRet = watchface_editable_add_edit_ready_cb(RequestEditOnEditReadyCb, NULL); + if(g_bFeatureNotSupported) + return 0; + if(g_bIsFeatureMismatched) + return 1; + PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_add_edit_ready_cb", WatchfaceComplicationGetError(nRet)); + + RunEditorApp(); + IterateGmainLoop(); + + if(!g_bCallBackHit) + { + FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "UpdateRequestedCb"); + nRet = watchface_editable_remove_edit_ready_cb(DesignElementOnEditReadyCb); + PRINT_RESULT_EXIT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 1; + } + nRet = watchface_editable_remove_edit_ready_cb(RequestEditOnEditReadyCb); + PRINT_RESULT_EXIT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); + return 0; +} + +//& purpose: To add and remove the callback function to request edit +//& type: auto +/** +* @testcase ITc_watchface_editable_add_remove_edit_ready_cb_p +* @since_tizen 5.0 +* @author SRID(p.chauhan) +* @reviewer SRID(manoj.g2) +* @type auto +* @description Adds and removes the callback function to request edit. +* @scenario Adds and removes the callback function to request edit. +* @apicovered watchface_editable_add_edit_ready_cb, watchface_editable_remove_edit_ready_cb +* @passcase Target APIs return 0 +* @failcase target APIs return 1 +* @precondition N/A +* @postcondition N/A +* */ +int ITc_watchface_editable_add_remove_edit_ready_cb_p(void) +{ + START_TEST; + g_bCallBackHit = false; + int nRet = watchface_editable_add_edit_ready_cb(WatchfaceEditableEditReadyCb, NULL); + ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_editable_add_edit_ready_cb"); + PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_add_edit_ready_cb", WatchfaceComplicationGetError(nRet)); + RunEditorApp(); + IterateGmainLoop(); + if(!g_bCallBackHit) + { + FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "WatchfaceEditableEditReadyCb"); + nRet = watchface_editable_remove_edit_ready_cb(WatchfaceEditableEditReadyCb); + PRINT_RESULT_EXIT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 1; + } + nRet = watchface_editable_remove_edit_ready_cb(WatchfaceEditableEditReadyCb); + PRINT_RESULT_EXIT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 0; +} + +//& purpose: To get the current data in editable +//& type: auto +/** +* @testcase ITc_watchface_editable_get_current_data_p +* @since_tizen 5.0 +* @author SRID(p.chauhan) +* @reviewer SRID(manoj.g2) +* @type auto +* @description Gets the current data in editable. +* @scenario Gets the current data in editable. +* @apicovered watchface_editable_get_current_data +* @passcase watchface_editable_get_current_data returns 0 +* @failcase watchface_editable_get_current_data returns 1 +* @precondition N/A +* @postcondition N/A +* */ +int ITc_watchface_editable_get_current_data_p(void) +{ + START_TEST; + watchface_editable_h hHandle = NULL; + g_bCallBackHit = false; + + int nRet = watchface_editable_add_edit_ready_cb(GetCurDataOnEditReadyCb, NULL); + if(g_bFeatureNotSupported) + return 0; + if(g_bIsFeatureMismatched) + return 1; + PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_add_edit_ready_cb", WatchfaceComplicationGetError(nRet)); + + RunEditorApp(); + IterateGmainLoop(); + + if(!g_bCallBackHit) + { + FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "GetCurDataUpdateRequestedCb"); + nRet = watchface_editable_remove_edit_ready_cb(GetCurDataOnEditReadyCb); + PRINT_RESULT_EXIT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 1; + } + nRet = watchface_editable_remove_edit_ready_cb(GetCurDataOnEditReadyCb); + PRINT_RESULT_EXIT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 0; +} + +//& purpose: To get the index of current data +//& type: auto +/** +* @testcase ITc_watchface_editable_get_current_data_idx_p +* @since_tizen 5.0 +* @author SRID(p.chauhan) +* @reviewer SRID(manoj.g2) +* @type auto +* @description Gets the index of current data. +* @scenario Gets the index of current data. +* @apicovered watchface_editable_get_current_data_idx +* @passcase watchface_editable_get_current_data_idx returns 0 +* @failcase watchface_editable_get_current_data_idx returns 1 +* @precondition N/A +* @postcondition N/A +* */ +int ITc_watchface_editable_get_current_data_idx_p(void) +{ + START_TEST; + watchface_editable_h hHandle = NULL; + g_bCallBackHit = false; + + int nRet = watchface_editable_add_edit_ready_cb(GetCurDataIdxOnEditReadyCb, NULL); + if(g_bFeatureNotSupported) + return 0; + if(g_bIsFeatureMismatched) + return 1; + PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_add_edit_ready_cb", WatchfaceComplicationGetError(nRet)); + + RunEditorApp(); + IterateGmainLoop(); + + if(!g_bCallBackHit) + { + FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "GetCurDataIdxUpdateRequestedCb"); + nRet = watchface_editable_remove_edit_ready_cb(GetCurDataIdxOnEditReadyCb); + PRINT_RESULT_EXIT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 1; + } + nRet = watchface_editable_remove_edit_ready_cb(GetCurDataIdxOnEditReadyCb); + PRINT_RESULT_EXIT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 0; +} + +//& purpose: To get the id of editable +//& type: auto +/** +* @testcase ITc_watchface_editable_get_editable_id_p +* @since_tizen 5.0 +* @author SRID(p.chauhan) +* @reviewer SRID(manoj.g2) +* @type auto +* @description Gets the id of editable. +* @scenario Gets the id of editable. +* @apicovered watchface_editable_get_editable_id +* @passcase watchface_editable_get_editable_id returns 0 +* @failcase watchface_editable_get_editable_id returns 1 +* @precondition N/A +* @postcondition N/A +* */ +int ITc_watchface_editable_get_editable_id_p(void) +{ + START_TEST; + watchface_editable_h hHandle = NULL; + g_bCallBackHit = false; + + int nRet = watchface_editable_add_edit_ready_cb(GetEditableIdOnEditReadyCb, NULL); + if(g_bFeatureNotSupported) + return 0; + if(g_bIsFeatureMismatched) + return 1; + PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_add_edit_ready_cb", WatchfaceComplicationGetError(nRet)); + + RunEditorApp(); + IterateGmainLoop(); + + if(!g_bCallBackHit) + { + FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "GetEditableIdUpdateRequestedCb"); + nRet = watchface_editable_remove_edit_ready_cb(GetEditableIdOnEditReadyCb); + PRINT_RESULT_EXIT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 1; + } + nRet = watchface_editable_remove_edit_ready_cb(GetEditableIdOnEditReadyCb); + PRINT_RESULT_EXIT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 0; +} + +//& purpose: To get the editable information of the specified Id +//& type: auto +/** +* @testcase ITc_watchface_editable_load_current_data_p +* @since_tizen 5.0 +* @author SRID(p.chauhan) +* @reviewer SRID(manoj.g2) +* @type auto +* @description Gets the editable information of the specified Id. +* @scenario Gets the editable information of the specified Id. +* @apicovered watchface_editable_get_editable_id, watchface_editable_load_current_data +* @passcase Target APIs return 0 +* @failcase Target APIs return 1 +* @precondition Get specified Id by watchface_editable_get_editable_id() +* @postcondition N/A +* */ +int ITc_watchface_editable_load_current_data_p(void) +{ + START_TEST; + g_bCallBackHit = false; + int nRet = watchface_editable_add_edit_ready_cb(LoadCurrentDataOnEditReadyCb, NULL); + if(g_bFeatureNotSupported) + return 0; + if(g_bIsFeatureMismatched) + return 1; + PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_add_edit_ready_cb", WatchfaceComplicationGetError(nRet)); + + RunEditorApp(); + IterateGmainLoop(); + + if(!g_bCallBackHit) + { + FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "LoadCurrentDataUpdateRequestedCb"); + nRet = watchface_editable_remove_edit_ready_cb(LoadCurrentDataOnEditReadyCb); + PRINT_RESULT_EXIT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 1; + } + + nRet = watchface_editable_remove_edit_ready_cb(LoadCurrentDataOnEditReadyCb); + PRINT_RESULT_EXIT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 0; +} + +//& purpose: To set the name in editable +//& type: auto +/** +* @testcase ITc_watchface_editable_set_editable_name_p +* @since_tizen 5.0 +* @author SRID(p.chauhan) +* @reviewer SRID(manoj.g2) +* @type auto +* @description Sets the name in editable. +* @scenario Sets the name in editable. +* @apicovered watchface_editable_set_editable_name +* @passcase watchface_editable_set_editable_name returns 0 +* @failcase watchface_editable_set_editable_name returns 1 +* @precondition N/A +* @postcondition N/A +* */ +int ITc_watchface_editable_set_editable_name_p(void) +{ + START_TEST; + int nRet = 0; + g_bCallBackHit = false; + nRet = watchface_editable_add_edit_ready_cb(EditableSetNameOnEditReadyCb, NULL); + if(g_bFeatureNotSupported) + return 0; + if(g_bIsFeatureMismatched) + return 1; + PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_add_edit_ready_cb", WatchfaceComplicationGetError(nRet)); + + RunEditorApp(); + IterateGmainLoop(); + + if(!g_bCallBackHit) + { + FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "EditableSetNameUpdateRequestedCb"); + nRet = watchface_editable_remove_edit_ready_cb(EditableSetNameOnEditReadyCb); + PRINT_RESULT_EXIT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 1; + } + nRet = watchface_editable_remove_edit_ready_cb(EditableSetNameOnEditReadyCb); + PRINT_RESULT_EXIT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 0; +} + +//& purpose: To get the name of editable +//& type: auto +/** +* @testcase ITc_watchface_editable_get_editable_name_p +* @since_tizen 5.0 +* @author SRID(p.chauhan) +* @reviewer SRID(manoj.g2) +* @type auto +* @description Gets the id of editable. +* @scenario Gets the id of editable. +* @apicovered watchface_editable_set_editable_name,watchface_editable_get_editable_name +* @passcase Target APIs return 0 +* @failcase Target APIs return 1 +* @precondition Set Id by watchface_editable_set_editable_name() +* @postcondition N/A +* */ +int ITc_watchface_editable_get_editable_name_p(void) +{ + START_TEST; + int nRet; + g_bCallBackHit = false; + + nRet = watchface_editable_add_edit_ready_cb(EditableGetNameOnEditReadyCb, NULL); + if(g_bFeatureNotSupported) + return 0; + if(g_bIsFeatureMismatched) + return 1; + PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_add_edit_ready_cb", WatchfaceComplicationGetError(nRet)); + + RunEditorApp(); + IterateGmainLoop(); + + if(strncmp(g_pszEditableGetName, pszEditableSetName, strlen(pszEditableSetName))!= 0) + { + FPRINTF("[Line : %d][%s] %s failed. g_pszEditableGetName = %s\\n", __LINE__, API_NAMESPACE, "watchface_editable_get_editable_name", g_pszEditableGetName); + nRet = watchface_editable_remove_edit_ready_cb(EditableGetNameOnEditReadyCb); + PRINT_RESULT_EXIT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 1; + } + FREE_MEMORY(g_pszEditableGetName); + + if(!g_bCallBackHit) + { + FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "EditableGetNameUpdateRequestedCb"); + nRet = watchface_editable_remove_edit_ready_cb(EditableGetNameOnEditReadyCb); + PRINT_RESULT_EXIT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 1; + } + + nRet = watchface_editable_remove_edit_ready_cb(EditableGetNameOnEditReadyCb); + PRINT_RESULT_EXIT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 0; +} + +//& purpose: To get editable's highlight handle +//& type: auto +/** +* @testcase ITc_watchface_editable_get_highlight_p +* @since_tizen 5.0 +* @author SRID(p.chauhan) +* @reviewer SRID(manoj.g2) +* @type auto +* @description Gets editable's highlight handle. +* @scenario Gets editable's highlight handle. +* @apicovered watchface_editable_get_highlight, watchface_editable_highlight_get_geometry +* @passcase Target APIs return 0 +* @failcase Target APIs return 1 +* @precondition Gets highlight by watchface_editable_get_highlight() +* @postcondition N/A +* */ +int ITc_watchface_editable_get_highlight_p(void) +{ + START_TEST; + int nRet = watchface_editable_add_edit_ready_cb(GetHighlightOnEditReadyCb, NULL); + if(g_bFeatureNotSupported) + return 0; + if(g_bIsFeatureMismatched) + return 1; + PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_add_edit_ready_cb", WatchfaceComplicationGetError(nRet)); + + g_bCallBackHit = false; + RunEditorApp(); + IterateGmainLoop(); + + if(!g_bCallBackHit) + { + FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "GetHighlightUpdateRequestedCb"); + nRet = watchface_editable_remove_edit_ready_cb(GetHighlightOnEditReadyCb); + PRINT_RESULT_EXIT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 1; + } + + nRet = watchface_editable_remove_edit_ready_cb(GetHighlightOnEditReadyCb); + PRINT_RESULT_EXIT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 0; +} + +//& purpose: To set and get editable's highlight geometry info +//& type: auto +/** +* @testcase ITc_watchface_editable_set_get_geometry_p +* @since_tizen 5.0 +* @author SRID(p.chauhan) +* @reviewer SRID(manoj.g2) +* @type auto +* @description Sets and gets editable's highlight geometry info. +* @scenario Sets and gets editable's highlight geometry info. +* @apicovered watchface_editable_highlight_set_geometry, watchface_editable_highlight_get_geometry +* @passcase Target APIs return 0 +* @failcase Target APIs return 1 +* @precondition N/A +* @postcondition N/A +* */ +int ITc_watchface_editable_set_get_geometry_p(void) +{ + START_TEST; + int nRet = -1; + int nX = 0; + int nY = 0; + int nW = 0; + int nH = 0; + watchface_editable_highlight_h hHandle = NULL; + + nRet = watchface_editable_highlight_create(&hHandle, WATCHFACE_EDITABLE_SHAPE_TYPE_CIRCLE); + ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_editable_highlight_create"); + PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_highlight_create", WatchfaceComplicationGetError(nRet)); + CHECK_HANDLE_EXIT(hHandle, "watchface_editable_highlight_create"); + + nRet = watchface_editable_highlight_set_geometry(hHandle, GEO_X, GEO_Y, GEO_W, GEO_H); + PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_highlight_set_geometry", WatchfaceComplicationGetError(nRet), watchface_editable_highlight_destroy(hHandle)); + + nRet = watchface_editable_highlight_get_geometry(hHandle, &nX, &nY, &nW, &nH); + PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_highlight_get_geometry", WatchfaceComplicationGetError(nRet), watchface_editable_highlight_destroy(hHandle)); + + if( nX != GEO_X || nY != GEO_Y || nW != GEO_W || nH != GEO_H) + { + FPRINTF("[Line : %d][%s] %s failed. \\nnX = %d\\nnY = %d\\nnW = %d\\nnH = %d\\n", __LINE__, API_NAMESPACE, "watchface_editable_highlight_get_geometry", nX, nY, nH, nW); + nRet = watchface_editable_highlight_destroy(hHandle); + PRINT_RESULT_EXIT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_highlight_destroy", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 1; + } + + nRet = watchface_editable_highlight_destroy(hHandle); + PRINT_RESULT_EXIT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_highlight_destroy", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 0; +} + +//& purpose: To set and get editable's highlight shape type +//& type: auto +/** +* @testcase ITc_watchface_editable_highlight_set_get_shape_type_p +* @since_tizen 5.0 +* @author SRID(p.chauhan) +* @reviewer SRID(manoj.g2) +* @type auto +* @description Sets and Gets editable's highlight shape type. +* @scenario Sets and Gets editable's highlight shape type. +* @apicovered watchface_editable_highlight_set_shape_type, watchface_editable_highlight_get_shape_type +* @passcase Target APIs return 0 +* @failcase Target APIs return 1 +* @precondition N/A +* @postcondition N/A +* */ +int ITc_watchface_editable_highlight_set_get_shape_type_p(void) +{ + START_TEST; + int nRet = -1; + watchface_editable_highlight_h hHandle = NULL; + watchface_editable_shape_type_e eShape = WATCHFACE_EDITABLE_SHAPE_TYPE_CIRCLE; + + nRet = watchface_editable_highlight_create(&hHandle, WATCHFACE_EDITABLE_SHAPE_TYPE_CIRCLE); + ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_editable_highlight_create"); + PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_highlight_create", WatchfaceComplicationGetError(nRet)); + CHECK_HANDLE_EXIT(hHandle, "watchface_editable_highlight_create"); + + nRet = watchface_editable_highlight_set_shape_type(hHandle, WATCHFACE_EDITABLE_SHAPE_TYPE_RECT); + PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_highlight_set_shape_type", WatchfaceComplicationGetError(nRet), watchface_editable_highlight_destroy(hHandle)); + + nRet = watchface_editable_highlight_get_shape_type(hHandle, &eShape); + PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_highlight_get_shape_type", WatchfaceComplicationGetError(nRet), watchface_editable_highlight_destroy(hHandle)); + + if(eShape != WATCHFACE_EDITABLE_SHAPE_TYPE_RECT) + { + FPRINTF("[Line : %d][%s] %s failed. eShape = %d\\n", __LINE__, API_NAMESPACE, "watchface_editable_highlight_get_geometry", eShape); + nRet = watchface_editable_highlight_destroy(hHandle); + PRINT_RESULT_EXIT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_highlight_destroy", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 1; + } + + nRet = watchface_editable_highlight_destroy(hHandle); + PRINT_RESULT_EXIT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_highlight_destroy", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 0; +} + +//& purpose: To create and destroy editables highlight +//& type: auto +/** +* @testcase ITc_watchface_editable_highlight_create_destroy_p +* @since_tizen 5.0 +* @author SRID(p.chauhan) +* @reviewer SRID(manoj.g2) +* @type auto +* @description Creates and destroys editables highlight +* @scenario Creates and destroys editables highlight +* @apicovered watchface_editable_highlight_create, watchface_editable_highlight_destroy +* @passcase Target APIs return 0 +* @failcase Target APIs return 1 +* @precondition N/A +* @postcondition N/A; +* */ +int ITc_watchface_editable_highlight_create_destroy_p(void) +{ + START_TEST; + int nRet = -1; + watchface_editable_highlight_h hHandle = NULL; + nRet = watchface_editable_highlight_create(&hHandle, WATCHFACE_EDITABLE_SHAPE_TYPE_CIRCLE); + ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_editable_highlight_create"); + PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_highlight_create", WatchfaceComplicationGetError(nRet)); + CHECK_HANDLE_EXIT(hHandle, "watchface_editable_highlight_create"); + + nRet = watchface_editable_highlight_destroy(hHandle); + PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_highlight_destroy", WatchfaceComplicationGetError(nRet)); + service_app_exit(); + return 0; +} + diff --git a/src/itc/watchface-complication/res/wearable/org.tizen.complication_test-1.0.0-arm.tpk b/src/itc/watchface-complication/res/wearable/org.tizen.complication_test-1.0.0-arm.tpk new file mode 100644 index 000000000..5834120c3 Binary files /dev/null and b/src/itc/watchface-complication/res/wearable/org.tizen.complication_test-1.0.0-arm.tpk differ diff --git a/src/itc/watchface-complication/res/wearable/org.tizen.complication_test-1.0.0-x86.tpk b/src/itc/watchface-complication/res/wearable/org.tizen.complication_test-1.0.0-x86.tpk new file mode 100644 index 000000000..132693fe0 Binary files /dev/null and b/src/itc/watchface-complication/res/wearable/org.tizen.complication_test-1.0.0-x86.tpk differ diff --git a/src/itc/watchface-complication/res/wearable/org.tizen.watchface_sample_editor-1.0.0-arm.tpk b/src/itc/watchface-complication/res/wearable/org.tizen.watchface_sample_editor-1.0.0-arm.tpk new file mode 100644 index 000000000..275b27e51 Binary files /dev/null and b/src/itc/watchface-complication/res/wearable/org.tizen.watchface_sample_editor-1.0.0-arm.tpk differ diff --git a/src/itc/watchface-complication/res/wearable/org.tizen.watchface_sample_editor-1.0.0-x86.tpk b/src/itc/watchface-complication/res/wearable/org.tizen.watchface_sample_editor-1.0.0-x86.tpk new file mode 100644 index 000000000..e4eb90196 Binary files /dev/null and b/src/itc/watchface-complication/res/wearable/org.tizen.watchface_sample_editor-1.0.0-x86.tpk differ diff --git a/src/itc/watchface-complication/res/wearable/org.tizen.watchface_sample_provider-1.0.0-arm.tpk b/src/itc/watchface-complication/res/wearable/org.tizen.watchface_sample_provider-1.0.0-arm.tpk new file mode 100644 index 000000000..291dfc7cb Binary files /dev/null and b/src/itc/watchface-complication/res/wearable/org.tizen.watchface_sample_provider-1.0.0-arm.tpk differ diff --git a/src/itc/watchface-complication/res/wearable/org.tizen.watchface_sample_provider-1.0.0-x86.tpk b/src/itc/watchface-complication/res/wearable/org.tizen.watchface_sample_provider-1.0.0-x86.tpk new file mode 100644 index 000000000..7db98a08d Binary files /dev/null and b/src/itc/watchface-complication/res/wearable/org.tizen.watchface_sample_provider-1.0.0-x86.tpk differ diff --git a/src/itc/watchface-complication/tct-watchface-complication-native.c b/src/itc/watchface-complication/tct-watchface-complication-native.c new file mode 100755 index 000000000..f09485f80 --- /dev/null +++ b/src/itc/watchface-complication/tct-watchface-complication-native.c @@ -0,0 +1,226 @@ +// +// Copyright (c) 2019 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 +#include +#include +#include "tct_common.h" +#include "ITs-watchface-common.h" + +#ifdef WEARABLE //Starts WEARABLE +#include "tct-watchface-complication-native_wearable.h" +#endif //WEARABLE //End WEARABLE +#define COMPLICATION_TEST_APP "org.tizen.complication_test" + +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; + bool bIsEditing = false; + char* pszCallerAppId = NULL; + watchface_complication_event_type_e eEventType = WATCHFACE_COMPLICATION_EVENT_NONE; + + nRet = watchface_complication_provider_setup_is_editing(app_control, &bIsEditing); + if(nRet != WATCHFACE_COMPLICATION_ERROR_NONE) + { + FPRINTF("[Line : %d][%s] watchface_complication_provider_setup_is_editing returned %s error\\n", __LINE__, API_NAMESPACE, WatchfaceComplicationGetError(nRet)); + return; + } + + if (bIsEditing) { + bundle *pszContext = NULL; + char *pszCmd = NULL; + nRet = watchface_complication_provider_setup_get_context(app_control, &pszContext); + if(nRet != WATCHFACE_COMPLICATION_ERROR_NONE) + { + FPRINTF("[Line : %d][%s] watchface_complication_provider_setup_is_editing returned %s error\\n", __LINE__, API_NAMESPACE, WatchfaceComplicationGetError(nRet)); + return; + } + if(pszContext == NULL) + { + FPRINTF("[Line : %d][%s] watchface_complication_provider_setup_is_editing failed, error returned = Handle returned is NULL\\n", __LINE__, API_NAMESPACE); + return; + } + bundle_get_str(pszContext, "CONTEXT_DATA", &pszCmd); + nRet = get_last_result(); + if(nRet != BUNDLE_ERROR_NONE) + { + FPRINTF("[Line : %d][%s] bundle_get_str returned %s error\\n", __LINE__, API_NAMESPACE, BundleGetError(nRet)); + FREE_MEMORY(pszContext); + return; + } + if(pszCmd == NULL) + { + FPRINTF("[Line : %d][%s] bundle_get_str failed, error returned = Handle returned is NULL\\n", __LINE__, API_NAMESPACE); + FREE_MEMORY(pszContext); + return; + } + g_hTestControl = NULL; + nRet = app_control_clone(&g_hTestControl, app_control); + if(nRet != APP_CONTROL_ERROR_NONE) + { + FPRINTF("[Line : %d][%s] app_control_clone returned %s error\\n", __LINE__, API_NAMESPACE, AppControlGetError(nRet)); + FREE_MEMORY(pszContext); + FREE_MEMORY(pszCmd); + return; + } + if(g_hTestControl == NULL) + { + FPRINTF("[Line : %d][%s] app_control_clone failed, error returned = Handle returned is NULL\\n", __LINE__, API_NAMESPACE); + FREE_MEMORY(pszContext); + FREE_MEMORY(pszCmd); + return; + } + if (pszCmd && strcmp(pszCmd, SETUP_IS_EDITING_TEST_VAL) == 0) + WatchfaceComplicationProviderSetupIsEditingChecker(); + else if (pszCmd && strcmp(pszCmd, SETUP_REPLY_TO_EDITOR_TEST_VAL) == 0) + WatchfaceComplicationProviderSetupReplyToEditorChecker(); + else if (pszCmd && strcmp(pszCmd, SETUP_GET_CONTEXT_TEST_VAL) == 0) + WatchfaceComplicationProviderSetupGetContextChecker(); + FREE_MEMORY(pszContext); + FREE_MEMORY(pszCmd); + return; + } + + nRet = watchface_complication_provider_event_get_type(app_control, &eEventType); + if(nRet != WATCHFACE_COMPLICATION_ERROR_NONE) + { + FPRINTF("[Line : %d][%s] watchface_complication_provider_event_get_type returned %s error\\n", __LINE__, API_NAMESPACE, WatchfaceComplicationGetError(nRet)); + return; + } + + if (eEventType != WATCHFACE_COMPLICATION_EVENT_NONE) { + nRet = app_control_clone(&g_hTestControl, app_control); + if(nRet != APP_CONTROL_ERROR_NONE) + { + FPRINTF("[Line : %d][%s] app_control_clone returned %s error\\n", __LINE__, API_NAMESPACE, AppControlGetError(nRet)); + return; + } + if(g_hTestControl == NULL) + { + FPRINTF("[Line : %d][%s] app_control_clone failed, error returned = Handle returned is NULL\\n", __LINE__, API_NAMESPACE); + return; + } + if (g_pszEventCmd && strcmp(g_pszEventCmd, EVENT_GET_EVENT_TYPE_TEST_VAL) == 0) + WatchfaceComplicationProviderEventGetTypeChecker(); + else if (g_pszEventCmd && strcmp(g_pszEventCmd, EVENT_GET_PROVIDER_ID_TEST_VAL) == 0) + WatchfaceComplicationProviderEventGetProviderIdChecker(); + else if (g_pszEventCmd && strcmp(g_pszEventCmd, EVENT_GET_COMP_TYPE_TEST_VAL) == 0) + WatchfaceComplicationProviderEventGetComplicationTypeChecker(); + else if (g_pszEventCmd && strcmp(g_pszEventCmd, EVENT_GET_CONTEXT_TEST_VAL) == 0) + WatchfaceComplicationProviderEventGetContextChecker(); + return; + } + + nRet = app_control_get_caller(app_control, &pszCallerAppId); + if (pszCallerAppId != NULL && strcmp(pszCallerAppId, COMPLICATION_TEST_APP) == 0) { + FREE_MEMORY(pszCallerAppId); + return; + } + FREE_MEMORY(pszCallerAppId); + + 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)) ) + { + 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); + + 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); + app_control_destroy(app_control); + 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; + + service_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 = service_app_main(argc, argv, &event_callback, NULL); + if (ret != APP_ERROR_NONE) + { + dlog_print(DLOG_ERROR, "NativeTCT", "Application service_app_main call gets failed. err = %d", ret); + PRINT_UTC_LOG("\\n[%s][Line : %d]Application service_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/itc/watchface-complication/tct-watchface-complication-native_wearable.h b/src/itc/watchface-complication/tct-watchface-complication-native_wearable.h new file mode 100755 index 000000000..07cba69dc --- /dev/null +++ b/src/itc/watchface-complication/tct-watchface-complication-native_wearable.h @@ -0,0 +1,147 @@ +// +// Copyright (c) 2019 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_WATCHFACE-COMPLICATION-NATIVE_H__ +#define __TCT_WATCHFACE-COMPLICATION-NATIVE_H__ + +#include "testcase.h" +#include "tct_common.h" + + +extern void ITs_watchface_complication_provider_startup(void); +extern void ITs_watchface_complication_provider_cleanup(void); +extern int ITc_watchface_complication_provider_add_remove_update_requested_cb_p(void); +extern int ITc_watchface_complication_provider_notify_update_p(void); +extern int ITc_watchface_complication_provider_setup_get_context_p(void); +extern int ITc_watchface_complication_provider_setup_reply_to_editor_p(void); +extern int ITc_watchface_complication_provider_setup_is_editing_p(void); +extern int ITc_watchface_complication_provider_data_set_short_text_p(void); +extern int ITc_watchface_complication_provider_data_set_long_text_p(void); +extern int ITc_watchface_complication_provider_data_set_title_p(void); +extern int ITc_watchface_complication_provider_data_set_timestamp_p(void); +extern int ITc_watchface_complication_provider_data_set_image_path_p(void); +extern int ITc_watchface_complication_provider_data_set_ranged_value_p(void); +extern int ITc_watchface_complication_provider_data_set_icon_path_p(void); +extern int ITc_watchface_complication_provider_data_set_extra_data_p(void); +extern int ITc_watchface_complication_provider_event_get_type_p(void); +extern int ITc_watchface_complication_provider_event_get_provider_id_p(void); +extern int ITc_watchface_complication_provider_event_get_complication_type_p(void); +extern int ITc_watchface_complication_provider_event_get_context_p(void); +extern int ITc_watchface_complication_provider_data_set_screen_reader_text_p(void); +extern int ITc_watchface_complication_provider_data_is_valid_p(void); + +extern void ITs_watchface_complication_startup(void); +extern void ITs_watchface_complication_cleanup(void); +extern int ITc_watchface_complication_get_current_provider_id_p(void); +extern int ITc_watchface_complication_get_current_type_p(void); +extern int ITc_watchface_complication_create_destroy_p(void); +extern int ITc_watchface_complication_data_get_type_p(void); +extern int ITc_watchface_complication_data_get_long_text_p(void); +extern int ITc_watchface_complication_data_get_short_text_p(void); +extern int ITc_watchface_complication_data_get_title_p(void); +extern int ITc_watchface_complication_data_get_timestamp_p(void); +extern int ITc_watchface_complication_data_get_image_path_p(void); +extern int ITc_watchface_complication_data_get_ranged_value_p(void); +extern int ITc_watchface_complication_data_get_icon_path_p(void); +extern int ITc_watchface_complication_data_get_extra_data_p(void); +extern int ITc_watchface_complication_allowed_list_create_destroy_p(void); +extern int ITc_watchface_complication_allowed_list_add_delete_p(void); +extern int ITc_watchface_complication_allowed_list_get_nth_p(void); +extern int ITc_watchface_complication_allowed_list_apply_clear_p(void); +extern int ITc_watchface_complication_add_update_remove_updated_cb_p(void); +extern int ITc_watchface_complication_data_get_screen_reader_text_p(void); +extern int ITc_watchface_complication_transfer_event_p(void); + +extern void ITs_watchface_editable_startup(void); +extern void ITs_watchface_editable_cleanup(void); +extern int ITc_watchface_editable_candidates_list_create_add_destroy_p(void); +extern int ITc_watchface_editable_add_complication_p(void); +extern int ITc_watchface_editable_get_nth_data_p(void); +extern int ITc_watchface_editable_add_design_element_p(void); +extern int ITc_watchface_editable_request_edit_p(void); +extern int ITc_watchface_editable_add_remove_edit_ready_cb_p(void); +extern int ITc_watchface_editable_get_current_data_p(void); +extern int ITc_watchface_editable_get_current_data_idx_p(void); +extern int ITc_watchface_editable_get_editable_id_p(void); +extern int ITc_watchface_editable_load_current_data_p(void); +extern int ITc_watchface_editable_set_editable_name_p(void); +extern int ITc_watchface_editable_get_editable_name_p(void); +extern int ITc_watchface_editable_get_highlight_p(void); +extern int ITc_watchface_editable_set_get_geometry_p(void); +extern int ITc_watchface_editable_highlight_set_get_shape_type_p(void); +extern int ITc_watchface_editable_highlight_create_destroy_p(void); + +testcase tc_array[] = { + {"ITc_watchface_complication_provider_add_remove_update_requested_cb_p", ITc_watchface_complication_provider_add_remove_update_requested_cb_p, ITs_watchface_complication_provider_startup, ITs_watchface_complication_provider_cleanup}, + {"ITc_watchface_complication_provider_notify_update_p", ITc_watchface_complication_provider_notify_update_p, ITs_watchface_complication_provider_startup, ITs_watchface_complication_provider_cleanup}, + {"ITc_watchface_complication_provider_setup_reply_to_editor_p", ITc_watchface_complication_provider_setup_reply_to_editor_p, ITs_watchface_complication_provider_startup, ITs_watchface_complication_provider_cleanup}, + {"ITc_watchface_complication_provider_setup_is_editing_p", ITc_watchface_complication_provider_setup_is_editing_p, ITs_watchface_complication_provider_startup, ITs_watchface_complication_provider_cleanup}, + {"ITc_watchface_complication_provider_setup_get_context_p", ITc_watchface_complication_provider_setup_get_context_p, ITs_watchface_complication_provider_startup, ITs_watchface_complication_provider_cleanup}, + {"ITc_watchface_complication_provider_data_set_short_text_p", ITc_watchface_complication_provider_data_set_short_text_p, ITs_watchface_complication_provider_startup, ITs_watchface_complication_provider_cleanup}, + {"ITc_watchface_complication_provider_data_set_long_text_p", ITc_watchface_complication_provider_data_set_long_text_p, ITs_watchface_complication_provider_startup, ITs_watchface_complication_provider_cleanup}, + {"ITc_watchface_complication_provider_data_set_title_p", ITc_watchface_complication_provider_data_set_title_p, ITs_watchface_complication_provider_startup, ITs_watchface_complication_provider_cleanup}, + {"ITc_watchface_complication_provider_data_set_timestamp_p", ITc_watchface_complication_provider_data_set_timestamp_p, ITs_watchface_complication_provider_startup, ITs_watchface_complication_provider_cleanup}, + {"ITc_watchface_complication_provider_data_set_image_path_p", ITc_watchface_complication_provider_data_set_image_path_p, ITs_watchface_complication_provider_startup, ITs_watchface_complication_provider_cleanup}, + {"ITc_watchface_complication_provider_data_set_ranged_value_p", ITc_watchface_complication_provider_data_set_ranged_value_p, ITs_watchface_complication_provider_startup, ITs_watchface_complication_provider_cleanup}, + {"ITc_watchface_complication_provider_data_set_icon_path_p", ITc_watchface_complication_provider_data_set_icon_path_p, ITs_watchface_complication_provider_startup, ITs_watchface_complication_provider_cleanup}, + {"ITc_watchface_complication_provider_data_set_extra_data_p", ITc_watchface_complication_provider_data_set_extra_data_p, ITs_watchface_complication_provider_startup, ITs_watchface_complication_provider_cleanup}, + {"ITc_watchface_complication_provider_event_get_type_p", ITc_watchface_complication_provider_event_get_type_p, ITs_watchface_complication_provider_startup, ITs_watchface_complication_provider_cleanup}, + {"ITc_watchface_complication_provider_event_get_provider_id_p", ITc_watchface_complication_provider_event_get_provider_id_p, ITs_watchface_complication_provider_startup, ITs_watchface_complication_provider_cleanup}, + {"ITc_watchface_complication_provider_event_get_complication_type_p", ITc_watchface_complication_provider_event_get_complication_type_p, ITs_watchface_complication_provider_startup, ITs_watchface_complication_provider_cleanup}, + {"ITc_watchface_complication_provider_event_get_context_p", ITc_watchface_complication_provider_event_get_context_p, ITs_watchface_complication_provider_startup, ITs_watchface_complication_provider_cleanup}, + {"ITc_watchface_complication_provider_data_set_screen_reader_text_p", ITc_watchface_complication_provider_data_set_screen_reader_text_p, ITs_watchface_complication_provider_startup, ITs_watchface_complication_provider_cleanup}, + {"ITc_watchface_complication_provider_data_is_valid_p", ITc_watchface_complication_provider_data_is_valid_p, ITs_watchface_complication_provider_startup, ITs_watchface_complication_provider_cleanup}, + + {"ITc_watchface_complication_get_current_provider_id_p", ITc_watchface_complication_get_current_provider_id_p, ITs_watchface_complication_startup, ITs_watchface_complication_cleanup}, + {"ITc_watchface_complication_get_current_type_p", ITc_watchface_complication_get_current_type_p, ITs_watchface_complication_startup, ITs_watchface_complication_cleanup}, + {"ITc_watchface_complication_create_destroy_p", ITc_watchface_complication_create_destroy_p, ITs_watchface_complication_startup, ITs_watchface_complication_cleanup}, + {"ITc_watchface_complication_data_get_type_p", ITc_watchface_complication_data_get_type_p, ITs_watchface_complication_startup, ITs_watchface_complication_cleanup}, + {"ITc_watchface_complication_data_get_long_text_p", ITc_watchface_complication_data_get_long_text_p, ITs_watchface_complication_startup, ITs_watchface_complication_cleanup}, + {"ITc_watchface_complication_data_get_short_text_p", ITc_watchface_complication_data_get_short_text_p, ITs_watchface_complication_startup, ITs_watchface_complication_cleanup}, + {"ITc_watchface_complication_data_get_timestamp_p", ITc_watchface_complication_data_get_timestamp_p, ITs_watchface_complication_startup, ITs_watchface_complication_cleanup}, + {"ITc_watchface_complication_data_get_image_path_p", ITc_watchface_complication_data_get_image_path_p, ITs_watchface_complication_startup, ITs_watchface_complication_cleanup}, + {"ITc_watchface_complication_data_get_ranged_value_p", ITc_watchface_complication_data_get_ranged_value_p, ITs_watchface_complication_startup, ITs_watchface_complication_cleanup}, + {"ITc_watchface_complication_data_get_icon_path_p", ITc_watchface_complication_data_get_icon_path_p, ITs_watchface_complication_startup, ITs_watchface_complication_cleanup}, + {"ITc_watchface_complication_data_get_extra_data_p", ITc_watchface_complication_data_get_extra_data_p, ITs_watchface_complication_startup, ITs_watchface_complication_cleanup}, + {"ITc_watchface_complication_allowed_list_create_destroy_p", ITc_watchface_complication_allowed_list_create_destroy_p, ITs_watchface_complication_startup, ITs_watchface_complication_cleanup}, + {"ITc_watchface_complication_allowed_list_add_delete_p", ITc_watchface_complication_allowed_list_add_delete_p, ITs_watchface_complication_startup, ITs_watchface_complication_cleanup}, + {"ITc_watchface_complication_allowed_list_get_nth_p", ITc_watchface_complication_allowed_list_get_nth_p, ITs_watchface_complication_startup, ITs_watchface_complication_cleanup}, + {"ITc_watchface_complication_allowed_list_apply_clear_p", ITc_watchface_complication_allowed_list_apply_clear_p, ITs_watchface_complication_startup, ITs_watchface_complication_cleanup}, + {"ITc_watchface_complication_data_get_title_p", ITc_watchface_complication_data_get_title_p, ITs_watchface_complication_startup, ITs_watchface_complication_cleanup}, + {"ITc_watchface_complication_add_update_remove_updated_cb_p", ITc_watchface_complication_add_update_remove_updated_cb_p, ITs_watchface_complication_startup, ITs_watchface_complication_cleanup}, + {"ITc_watchface_complication_data_get_screen_reader_text_p", ITc_watchface_complication_data_get_screen_reader_text_p, ITs_watchface_complication_startup, ITs_watchface_complication_cleanup}, + {"ITc_watchface_complication_transfer_event_p", ITc_watchface_complication_transfer_event_p, ITs_watchface_complication_startup, ITs_watchface_complication_cleanup}, + + {"ITc_watchface_editable_candidates_list_create_add_destroy_p", ITc_watchface_editable_candidates_list_create_add_destroy_p, ITs_watchface_editable_startup, ITs_watchface_editable_cleanup}, + {"ITc_watchface_editable_add_complication_p", ITc_watchface_editable_add_complication_p, ITs_watchface_editable_startup, ITs_watchface_editable_cleanup}, + {"ITc_watchface_editable_get_nth_data_p", ITc_watchface_editable_get_nth_data_p, ITs_watchface_editable_startup, ITs_watchface_editable_cleanup}, + {"ITc_watchface_editable_add_design_element_p", ITc_watchface_editable_add_design_element_p, ITs_watchface_editable_startup, ITs_watchface_editable_cleanup}, + {"ITc_watchface_editable_request_edit_p", ITc_watchface_editable_request_edit_p, ITs_watchface_editable_startup, ITs_watchface_editable_cleanup}, + {"ITc_watchface_editable_add_remove_edit_ready_cb_p", ITc_watchface_editable_add_remove_edit_ready_cb_p, ITs_watchface_editable_startup, ITs_watchface_editable_cleanup}, + {"ITc_watchface_editable_get_current_data_p", ITc_watchface_editable_get_current_data_p, ITs_watchface_editable_startup, ITs_watchface_editable_cleanup}, + {"ITc_watchface_editable_get_current_data_idx_p", ITc_watchface_editable_get_current_data_idx_p, ITs_watchface_editable_startup, ITs_watchface_editable_cleanup}, + {"ITc_watchface_editable_get_editable_id_p", ITc_watchface_editable_get_editable_id_p, ITs_watchface_editable_startup, ITs_watchface_editable_cleanup}, + {"ITc_watchface_editable_load_current_data_p", ITc_watchface_editable_load_current_data_p, ITs_watchface_editable_startup, ITs_watchface_editable_cleanup}, + {"ITc_watchface_editable_set_editable_name_p", ITc_watchface_editable_set_editable_name_p, ITs_watchface_editable_startup, ITs_watchface_editable_cleanup}, + {"ITc_watchface_editable_get_editable_name_p", ITc_watchface_editable_get_editable_name_p, ITs_watchface_editable_startup, ITs_watchface_editable_cleanup}, + {"ITc_watchface_editable_get_highlight_p", ITc_watchface_editable_get_highlight_p, ITs_watchface_editable_startup, ITs_watchface_editable_cleanup}, + {"ITc_watchface_editable_set_get_geometry_p", ITc_watchface_editable_set_get_geometry_p, ITs_watchface_editable_startup, ITs_watchface_editable_cleanup}, + {"ITc_watchface_editable_highlight_set_get_shape_type_p", ITc_watchface_editable_highlight_set_get_shape_type_p, ITs_watchface_editable_startup, ITs_watchface_editable_cleanup}, + {"ITc_watchface_editable_highlight_create_destroy_p", ITc_watchface_editable_highlight_create_destroy_p, ITs_watchface_editable_startup, ITs_watchface_editable_cleanup}, + + {NULL, NULL} +}; + +#endif // __TCT_WATCHFACE-NATIVE_H__ diff --git a/src/itc/watchface/CMakeLists.txt b/src/itc/watchface/CMakeLists.txt deleted file mode 100644 index ed9ee2607..000000000 --- a/src/itc/watchface/CMakeLists.txt +++ /dev/null @@ -1,42 +0,0 @@ -SET(PKG_NAME "watchface") - -SET(EXEC_NAME "tct-${PKG_NAME}-native") -SET(RPM_NAME "native-${PKG_NAME}-itc") - -SET(CAPI_LIB "watchface") -SET(TC_SOURCES - ITs-watchface-common.c - ITs-watchface-complication.c - ITs-watchface-editable.c - ITs-watchface-complication-provider.c -) - -PKG_CHECK_MODULES(${CAPI_LIB} REQUIRED - ${CAPI_LIB} - capi-appfw-application - libsystemd-journal - bundle - glib-2.0 - capi-system-info -) - -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/itc/watchface/ITs-watchface-common.c b/src/itc/watchface/ITs-watchface-common.c deleted file mode 100644 index 6432899f8..000000000 --- a/src/itc/watchface/ITs-watchface-common.c +++ /dev/null @@ -1,134 +0,0 @@ -// -// Copyright (c) 2018 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 "ITs-watchface-common.h" - -/** @addtogroup itc-watchface -* @ingroup itc -* @{ -*/ - -/** -* @function WatchfaceComplicationGetError -* @description Maps error enums to string values for watchface -* @parameter nRet : error code returned -* @return error string -*/ -char* WatchfaceComplicationGetError(int nRet) -{ - char *szErrorVal = NULL; - switch( nRet ) - { - - case WATCHFACE_COMPLICATION_ERROR_NONE: szErrorVal = "TIZEN_ERROR_NONE"; break; - case WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY: szErrorVal = "TIZEN_ERROR_OUT_OF_MEMORY"; break; - case WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER: szErrorVal = "TIZEN_ERROR_INVALID_PARAMETER"; break; - case WATCHFACE_COMPLICATION_ERROR_IO_ERROR: szErrorVal = "TIZEN_ERROR_IO_ERROR"; break; - case WATCHFACE_COMPLICATION_ERROR_NO_DATA: szErrorVal = "TIZEN_ERROR_NO_DATA"; break; - case WATCHFACE_COMPLICATION_ERROR_PERMISSION_DENIED: szErrorVal = "TIZEN_ERROR_PERMISSION_DENIED"; break; - case WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED: szErrorVal = "TIZEN_ERROR_NOT_SUPPORTED"; break; - case WATCHFACE_COMPLICATION_ERROR_DB: szErrorVal = "TIZEN_ERROR_COMPLICATION | 0x1"; break; - case WATCHFACE_COMPLICATION_ERROR_DBUS: szErrorVal = "TIZEN_ERROR_COMPLICATION | 0x2"; break; - case WATCHFACE_COMPLICATION_ERROR_EDIT_NOT_READY: szErrorVal = "TIZEN_ERROR_COMPLICATION | 0x3"; break; - case WATCHFACE_COMPLICATION_ERROR_EXIST_ID: szErrorVal = "TIZEN_ERROR_COMPLICATION | 0x4"; break; - case WATCHFACE_COMPLICATION_ERROR_NOT_EXIST: szErrorVal = "TIZEN_ERROR_COMPLICATION | 0x5"; break; - case WATCHFACE_COMPLICATION_ERROR_PROVIDER_NOT_AVAILABLE: szErrorVal = "TIZEN_ERROR_COMPLICATION"; break; - } - return szErrorVal; -} - -/** -* @function AppControlGetError -* @description Maps error enums to string values -* @parameter nRet : error code returned -* @return error string -*/ -char* AppControlGetError(int nRet) -{ - char *szErrorVal = NULL; - switch ( nRet ) - { - case APP_CONTROL_ERROR_NONE: szErrorVal = "APP_CONTROL_ERROR_NONE";break; - case APP_CONTROL_ERROR_INVALID_PARAMETER: szErrorVal = "APP_CONTROL_ERROR_INVALID_PARAMETER";break; - case APP_CONTROL_ERROR_OUT_OF_MEMORY: szErrorVal = "APP_CONTROL_ERROR_OUT_OF_MEMORY";break; - case APP_CONTROL_ERROR_APP_NOT_FOUND: szErrorVal = "APP_CONTROL_ERROR_APP_NOT_FOUND";break; - case APP_CONTROL_ERROR_KEY_NOT_FOUND: szErrorVal = "APP_CONTROL_ERROR_KEY_NOT_FOUND";break; - case APP_CONTROL_ERROR_KEY_REJECTED: szErrorVal = "APP_CONTROL_ERROR_KEY_REJECTED";break; - case APP_CONTROL_ERROR_INVALID_DATA_TYPE: szErrorVal = "APP_CONTROL_ERROR_INVALID_DATA_TYPE";break; - case APP_CONTROL_ERROR_LAUNCH_REJECTED: szErrorVal = "APP_CONTROL_ERROR_LAUNCH_REJECTED";break; - case APP_CONTROL_ERROR_PERMISSION_DENIED: szErrorVal = "APP_CONTROL_ERROR_PERMISSION_DENIED";break; - case APP_CONTROL_ERROR_LAUNCH_FAILED: szErrorVal = "APP_CONTROL_ERROR_LAUNCH_FAILED";break; - case APP_CONTROL_ERROR_TIMED_OUT: szErrorVal = "APP_CONTROL_ERROR_TIMED_OUT";break; - default: szErrorVal = "Undefined Error";break; - } - return szErrorVal; -} - -/** -* @function BundleGetError -* @description Maps error enums to string values -* @parameter nRet : error code returned -* @return error string -*/ -char* BundleGetError(int nRet) -{ - char *szErrorVal = NULL; - switch ( nRet ) - { - case BUNDLE_ERROR_NONE: szErrorVal = "BUNDLE_ERROR_NONE"; break; - case BUNDLE_ERROR_OUT_OF_MEMORY: szErrorVal = "BUNDLE_ERROR_OUT_OF_MEMORY"; break; - case BUNDLE_ERROR_INVALID_PARAMETER: szErrorVal = "BUNDLE_ERROR_INVALID_PARAMETER"; break; - case BUNDLE_ERROR_KEY_NOT_AVAILABLE: szErrorVal = "BUNDLE_ERROR_KEY_NOT_AVAILABLE"; break; - case BUNDLE_ERROR_KEY_EXISTS: szErrorVal = "BUNDLE_ERROR_KEY_EXISTS"; break; - default: szErrorVal = "Unknown Error"; break; - } - return szErrorVal; -} - -/** - * @function TimeoutFunction - * @description Called if some callback is not invoked for a particular timeout - * @parameter gpointer data - * @return gboolean - */ -gboolean TimeoutFunction(gpointer data) -{ - GMainLoop *pMainLoop = NULL; - pMainLoop = (GMainLoop *)data; - if ( pMainLoop != NULL ) - { - g_main_loop_quit(pMainLoop); - } - return false; -} - -/** -* @function IterateGmainLoop -* @description Called to wait -* @parameter NA -* @return NA -*/ -void IterateGmainLoop(void) -{ - if(g_bCallBackHit != true) - { - g_pMainLoop = g_main_loop_new(NULL, false); - g_nTimeoutId = g_timeout_add(TIMEOUT_CB, TimeoutFunction, g_pMainLoop); - g_main_loop_run(g_pMainLoop); - g_source_remove(g_nTimeoutId); - g_nTimeoutId = 0; - g_pMainLoop = NULL; - } -} diff --git a/src/itc/watchface/ITs-watchface-common.h b/src/itc/watchface/ITs-watchface-common.h deleted file mode 100644 index e5d935958..000000000 --- a/src/itc/watchface/ITs-watchface-common.h +++ /dev/null @@ -1,262 +0,0 @@ -// -// Copyright (c) 2018 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 _ITS_WATCHFACE_COMMON_H_ -#define _ITS_WATCHFACE_COMMON_H_ - -//Add test package related includes here -#include -#include -#include -#include -#include - -#include "tct_common.h" -#include -#include - -/** @addtogroup itc-watchface -* @ingroup itc -* @{ -*/ - -bool g_bWatchfaceCreation; -GMainLoop *g_pMainLoop; -int g_nTimeoutId; -bool g_bCallBackHit; -bool g_bCheckerHit; -bool g_bWatchApp; -bool g_bFeatureNotSupported; -bool g_bIsFeatureMismatched; -app_control_h g_hTestControl; -char *g_pszEditableGetName; -char *g_pszEventCmd; -static char g_pszCheckUserData[] = "check_user_data"; - -#define pszEditableSetName "TEST" -#define API_NAMESPACE "WATCHFACE_ITC" -#define MAXENUMSIZE 50 -#define SETENUM 1 -#define GETENUM 0 -#define FEATURE_WATCH_APP "http://tizen.org/feature/watch_app" -#define TIMEOUT_CB 25000 - -#define SETUP_IS_EDITING_TEST_VAL "SETUP_IS_EDITING_TEST_VAL" -#define SETUP_REPLY_TO_EDITOR_TEST_VAL "SETUP_REPLY_TO_EDITOR_TEST_VAL" -#define SETUP_GET_CONTEXT_TEST_VAL "SETUP_GET_CONTEXT_VAL" - -#define EVENT_GET_PROVIDER_ID_TEST_VAL "EVENT_GET_PROVIDER_ID_TEST_VAL" -#define EVENT_GET_COMP_TYPE_TEST_VAL "EVENT_GET_COMP_TYPE_TEST_VAL" -#define EVENT_GET_CONTEXT_TEST_VAL "EVENT_GET_CONTEXT_TEST_VAL" -#define EVENT_GET_EVENT_TYPE_TEST_VAL "EVENT_GET_EVENT_TYPE_TEST_VAL" - - -#define START_TEST {\ - FPRINTF("[Line : %d][%s] Starting test : %s\\n", __LINE__, API_NAMESPACE, __FUNCTION__);\ -} - -#define CALLBACK_EXIT(eCompare, eRetVal, API, Error) {\ - if ( eRetVal == eCompare )\ -{\ - if ( DEBUG )\ -{\ - FPRINTF("[Line : %d][%s] %s passed\\n", __LINE__, API_NAMESPACE, API);\ -}\ -}\ - else \ -{\ - FPRINTF("[Line : %d][%s] %s failed, error returned = %s [%d]\\n", __LINE__, API_NAMESPACE, API, Error, eRetVal);\ - service_app_exit(); \ - return;\ -}\ -} - -#define CALLBACK_EXIT_CLEANUP(eCompare, eRetVal, API, Error, FreeResource) {\ - if ( eRetVal == eCompare )\ -{\ - if ( DEBUG )\ -{\ - FPRINTF("[Line : %d][%s] %s passed\\n", __LINE__, API_NAMESPACE, API);\ -}\ -}\ - else \ -{\ - FPRINTF("[Line : %d][%s] %s failed, error returned = %s [%d]\\n", __LINE__, API_NAMESPACE, API, Error, eRetVal);\ - FreeResource;\ - service_app_exit(); \ - return;\ -}\ -} - -#define CALLBACK_CHECK_HANDLE_EXIT(Handle, API) {\ - if ( Handle == NULL )\ -{\ - FPRINTF("[Line : %d][%s] %s failed, error returned = Handle returned is NULL\\n", __LINE__, API_NAMESPACE, API);\ - service_app_exit(); \ - return;\ -}\ -} - -#define CALLBACK_CHECK_HANDLE_EXIT_CLEANUP(Handle, API, FreeResource) {\ - if ( Handle == NULL )\ -{\ - FPRINTF("[Line : %d][%s] %s failed, error returned = Handle returned is NULL\\n", __LINE__, API_NAMESPACE, API);\ - FreeResource;\ - service_app_exit(); \ - return;\ -}\ -} - -#define CHECK_HANDLE(Handle, API) {\ - if ( Handle == NULL )\ -{\ - FPRINTF("[Line : %d][%s] %s failed, error returned = Handle returned is NULL\\n", __LINE__, API_NAMESPACE, API);\ - return 1;\ -}\ -} - -#define CHECK_HANDLE_EXIT(Handle, API) {\ - if ( Handle == NULL )\ -{\ - FPRINTF("[Line : %d][%s] %s failed, error returned = Handle returned is NULL\\n", __LINE__, API_NAMESPACE, API);\ - service_app_exit(); \ - return 1;\ -}\ -} - -#define CHECK_HANDLE_CLEANUP(Handle, API, FreeResource) {\ - if ( Handle == NULL )\ -{\ - FPRINTF("[Line : %d][%s] %s failed, error returned = Handle returned is NULL\\n", __LINE__, API_NAMESPACE, API);\ - FreeResource;\ - return 1;\ -}\ -} - -#define CHECK_HANDLE_EXIT_CLEANUP(Handle, API, FreeResource) {\ - if ( Handle == NULL )\ -{\ - FPRINTF("[Line : %d][%s] %s failed, error returned = Handle returned is NULL\\n", __LINE__, API_NAMESPACE, API);\ - FreeResource;\ - service_app_exit(); \ - return 1;\ -}\ -} - -#define PRINT_RESULT_EXIT(eCompare, eRetVal, API, Error) {\ - if ( eRetVal == eCompare )\ -{\ - if ( DEBUG )\ -{\ - FPRINTF("[Line : %d][%s] %s passed\\n", __LINE__, API_NAMESPACE, API);\ -}\ -}\ - else \ -{\ - FPRINTF("[Line : %d][%s] %s failed, error returned = %s [%d]\\n", __LINE__, API_NAMESPACE, API, Error, eRetVal);\ - service_app_exit(); \ - return 1;\ -}\ -} - -#define PRINT_RESULT_EXIT_NORETURN(eCompare, eRetVal, API, Error) {\ - if ( eRetVal == eCompare )\ -{\ - if ( DEBUG )\ -{\ - FPRINTF("[Line : %d][%s] %s passed\\n", __LINE__, API_NAMESPACE, API);\ -}\ -}\ - else \ -{\ - FPRINTF("[Line : %d][%s] %s failed, error returned = %s [%d]\\n", __LINE__, API_NAMESPACE, API, Error, eRetVal);\ - service_app_exit(); \ - return;\ -}\ -} - -#define PRINT_RESULT_EXIT_CLEANUP(eCompare, eRetVal, API, Error, FreeResource) {\ - if ( eRetVal == eCompare )\ -{\ - if ( DEBUG )\ -{\ - FPRINTF("[Line : %d][%s] %s passed\\n", __LINE__, API_NAMESPACE, API);\ -}\ -}\ -else \ -{\ - FPRINTF("[Line : %d][%s] %s failed, error returned = %s [%d]\\n", __LINE__, API_NAMESPACE, API, Error, eRetVal);\ - FreeResource;\ - service_app_exit(); \ - return 1;\ -}\ -} - -#define ISFEATURE_SUPPORTED_EXIT(eCompare, eRetVal, API) {\ - if ( !g_bWatchApp )\ -{\ - if ( eCompare == eRetVal )\ -{\ - FPRINTF("[Line:%d][%s] FeatureWatchApp not supported\\n", __LINE__, API_NAMESPACE);\ - g_bFeatureNotSupported = true;\ - service_app_exit();\ - return 0;\ -}\ - else \ -{\ - g_bIsFeatureMismatched = true;\ - FPRINTF("[Line : %d][%s] %s failed due to feature mismatch.\\n", __LINE__, API_NAMESPACE, API);\ - service_app_exit(); \ - return 1;\ -}\ -}\ -} - -#define CALLBACK_ISFEATURE_SUPPORTED_EXIT(eCompare, eRetVal, API) {\ - if ( !g_bWatchApp )\ -{\ - if ( eCompare == eRetVal )\ -{\ - FPRINTF("[Line:%d][%s] FeatureWatchApp not supported\\n", __LINE__, API_NAMESPACE);\ - g_bFeatureNotSupported = true;\ - service_app_exit();\ - return;\ -}\ - else \ -{\ - g_bIsFeatureMismatched = true;\ - FPRINTF("[Line : %d][%s] %s failed due to feature mismatch.\\n", __LINE__, API_NAMESPACE, API);\ - service_app_exit(); \ - return;\ -}\ -}\ -} - -char* WatchfaceComplicationGetError(int nRet); -char* AppControlGetError(int nRet); -char* BundleGetError(int nRet); -gboolean TimeoutFunction(gpointer data); -void IterateGmainLoop(void); -extern void WatchfaceComplicationProviderSetupGetContextChecker(void); -extern void WatchfaceComplicationProviderSetupReplyToEditorChecker(void); -extern void WatchfaceComplicationProviderSetupIsEditingChecker(void); -extern void WatchfaceComplicationProviderEventGetTypeChecker(void); -extern void WatchfaceComplicationProviderEventGetProviderIdChecker(void); -extern void WatchfaceComplicationProviderEventGetComplicationTypeChecker(void); -extern void WatchfaceComplicationProviderEventGetContextChecker(void); - - -/** @} */ -#endif //_ITS_watchface_COMMON_H_ diff --git a/src/itc/watchface/ITs-watchface-complication-provider.c b/src/itc/watchface/ITs-watchface-complication-provider.c deleted file mode 100755 index 13a47c183..000000000 --- a/src/itc/watchface/ITs-watchface-complication-provider.c +++ /dev/null @@ -1,1285 +0,0 @@ -// -// Copyright (c) 2018 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 -#include -#include -#include -#include -#include "ITs-watchface-common.h" -#define TEST_PROVIDER_ID "org.tizen.watchface_sample_provider/test" -#define PROVIDER_ID "org.tizen.watchface-complication-native-itc/test" -#define EDITOR_CMD_KEY "EDITOR_CMD" -#define EDITOR_ID "org.tizen.watchface_sample_editor" -#define WATCHFACE_ID "org.tizen.watchface_sample" -#define COMPLICATION_TEST_APP "org.tizen.complication_test" -#define MAX_COUNTER 5 -#define DATAISVALIDID 2 -static int nWatchfaceId = 0; - -/** @addtogroup itc-watchface -* @ingroup itc -* @{ -*/ - - -//& set: watchface - -/** -* @function ITs_watchface_complication_provider_startup -* @description Called before each test, set the service boolean true -* @parameter NA -* @nReturn NA -*/ -void ITs_watchface_complication_provider_startup(void) -{ -#if DEBUG - FPRINTF("[Line : %d][%s] TEST SUIT start-up: ITs_Watchface_Complication_Provider_p\\n", __LINE__, API_NAMESPACE); -#endif - g_bWatchApp = TCTCheckSystemInfoFeatureSupported(FEATURE_WATCH_APP, API_NAMESPACE); - g_bFeatureNotSupported = false; - g_bIsFeatureMismatched = false; - return; -} - -/** -* @function ITs_watchface_complication_provider_cleanup -* @description Called after each test -* @parameter NA -* @nReturn NA -*/ -void ITs_watchface_complication_provider_cleanup(void) -{ -#if DEBUG - FPRINTF("[Line : %d][%s] TEST SUIT clean-up: ITs_Watchface_Complication_Provider_p\\n", __LINE__, API_NAMESPACE); -#endif - return; -} - -/****************************************************Helper Functions Start****************************************************/ -/** -* @function RunApp -* @description Helper Function -* @parameters char *pszTargetApp, char *pszKey, char *pszValue, int nCompId -* @return NA -*/ -static void RunApp(char *pszTargetApp, char *pszKey, char *pszValue, int nCompId) -{ - FPRINTF("[Line : %d][%s] entered %s.\\n", __LINE__, API_NAMESPACE, "RunApp"); - static app_control_h hAppControl; - bool bIsRunning = false; - char pszCompId[10]; - int nCounter = MAX_COUNTER; - - int nRet = app_control_create(&hAppControl); - if(nRet != APP_CONTROL_ERROR_NONE) - { - FPRINTF("[Line : %d][%s] app_control_create returned %s error\\n", __LINE__, API_NAMESPACE, AppControlGetError(nRet)); - return; - } - if(hAppControl == NULL) - { - FPRINTF("[Line : %d][%s] %s failed, error returned = Handle returned is NULL\\n", __LINE__, API_NAMESPACE, "app_control_create"); - return; - } - - nRet = app_control_set_app_id(hAppControl, pszTargetApp); - if(nRet != APP_CONTROL_ERROR_NONE) - { - FPRINTF("[Line : %d][%s] app_control_set_app_id returned %s error\\n", __LINE__, API_NAMESPACE, AppControlGetError(nRet)); - app_control_destroy(hAppControl); - return; - } - - if (pszKey && pszValue) { - nRet = app_control_add_extra_data(hAppControl, pszKey, pszValue); - if(nRet != APP_CONTROL_ERROR_NONE) - { - FPRINTF("[Line : %d][%s] app_control_add_extra_data returned %s error\\n", __LINE__, API_NAMESPACE, AppControlGetError(nRet)); - app_control_destroy(hAppControl); - return; - } - } - sprintf(pszCompId, "%d", nCompId); - nRet = app_control_add_extra_data(hAppControl, "COMP_ID", pszCompId); - if(nRet != APP_CONTROL_ERROR_NONE) - { - FPRINTF("[Line : %d][%s] app_control_add_extra_data returned %s error\\n", __LINE__, API_NAMESPACE, AppControlGetError(nRet)); - app_control_destroy(hAppControl); - return; - } - - nRet = app_control_add_extra_data(hAppControl, "SENDER_ID", "org.tizen.watchface-native-itc"); - if(nRet != APP_CONTROL_ERROR_NONE) - { - FPRINTF("[Line : %d][%s] app_control_add_extra_data returned %s error\\n", __LINE__, API_NAMESPACE, AppControlGetError(nRet)); - app_control_destroy(hAppControl); - return; - } - - do { - nRet = app_control_send_launch_request(hAppControl, NULL, NULL); - if (nRet != APP_CONTROL_ERROR_NONE) - sleep(1); - app_manager_is_running(pszTargetApp, &bIsRunning); - } while (--nCounter > 0 && !bIsRunning); - sleep(1); - app_control_destroy(hAppControl); -} - -/** -* @function ComplicationProviderUpdateRequestedCb -* @description Callback Function -* @parameters const char *pszProviderId, const char *pszReqAppid, - watchface_complication_type_e eType, const bundle *pszContext,bundle *pszShareData, void *pszUserData -* @return NA -*/ -static void ComplicationProviderUpdateRequestedCb(const char *pszProviderId, const char *pszReqAppid, - watchface_complication_type_e eType, const bundle *pszContext,bundle *pszShareData, void *pszUserData) -{ - FPRINTF("[Line : %d][%s] %s invoked\\n", __LINE__, API_NAMESPACE, "ComplicationProviderUpdateRequestedCb"); - g_bCallBackHit = true; - return; -} - -/** -* @function UpdateRequestedCb -* @description Callback Function -* @parameters const watchface_editable_h hHandle, int nSelectedIdx, const watchface_editable_edit_state_e eState, void *pszUserData -* @return NA -*/ -static void UpdateRequestedCb(const watchface_editable_h hHandle, int nSelectedIdx, const watchface_editable_edit_state_e eState, void *pszUserData) -{ - FPRINTF("[Line : %d][%s] %s invoked\\n", __LINE__, API_NAMESPACE, "UpdateRequestedCb"); - g_bCallBackHit = true; - return; -} - -/** -* @function SetupOnEditReadyCb -* @description Callback Function -* @parameters watchface_editable_container_h hEdCon, const char *pszEditorAppid, void *pszUserData -* @return NA -*/ -static void SetupOnEditReadyCb(watchface_editable_container_h hEdCon, const char *pszEditorAppid, void *pszUserData) -{ - FPRINTF("[Line : %d][%s] %s invoked\\n", __LINE__, API_NAMESPACE, "SetupOnEditReadyCb"); - int nEditableId = 1; - complication_h hComp = NULL; - watchface_editable_highlight_h hHighlight = NULL; - - int nRet = watchface_editable_highlight_create(&hHighlight, WATCHFACE_EDITABLE_SHAPE_TYPE_CIRCLE); - CALLBACK_ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_editable_highlight_create"); - CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_highlight_create", WatchfaceComplicationGetError(nRet)); - CALLBACK_CHECK_HANDLE_EXIT(hHighlight, "watchface_editable_highlight_create"); - - nRet = watchface_editable_highlight_set_geometry(hHighlight, 100, 100, 30, 30); - CALLBACK_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_highlight_set_geometry", WatchfaceComplicationGetError(nRet), watchface_editable_highlight_destroy(hHighlight)); - - nRet = watchface_complication_create(1, TEST_PROVIDER_ID, - WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT, - WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT, - WATCHFACE_COMPLICATION_EVENT_NONE, &hComp); - CALLBACK_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_create", WatchfaceComplicationGetError(nRet), watchface_editable_highlight_destroy(hHighlight)); - CALLBACK_CHECK_HANDLE_EXIT_CLEANUP(hComp, "watchface_complication_create", watchface_editable_highlight_destroy(hHighlight)); - - nRet = watchface_editable_add_complication(hEdCon, nEditableId, hComp, hHighlight); - CALLBACK_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_highlight_create", WatchfaceComplicationGetError(nRet), watchface_editable_highlight_destroy(hHighlight);watchface_complication_destroy(hComp)); - - nRet = watchface_editable_request_edit(hEdCon, UpdateRequestedCb, NULL); - CALLBACK_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_request_edit", WatchfaceComplicationGetError(nRet), watchface_editable_highlight_destroy(hHighlight);watchface_complication_destroy(hComp)); - - watchface_editable_highlight_destroy(hHighlight); - watchface_complication_destroy(hComp); - service_app_exit(); - return; -} - -/** -* @function UpdateRequestedCb2 -* @description Callback Function -* @parameters const char *pszProviderId, const char *pszReqAppid, watchface_complication_type_e eType, const bundle *pszContext, - bundle *pszSharedData, void *pszUserData -* @return NA -*/ -static void UpdateRequestedCb2(const char *pszProviderId, const char *pszReqAppid, watchface_complication_type_e eType, const bundle *pszContext, - bundle *pszSharedData, void *pszUserData) -{ - FPRINTF("[Line : %d][%s] %s invoked\\n", __LINE__, API_NAMESPACE, "UpdateRequestedCb2"); - int nRet = WATCHFACE_COMPLICATION_ERROR_IO_ERROR; - switch(eType) - { - case WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT : - nRet = watchface_complication_provider_data_set_short_text(pszSharedData, "short text"); - CALLBACK_ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_provider_data_set_short_text"); - CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_data_set_short_text", WatchfaceComplicationGetError(nRet)); - nRet = watchface_complication_provider_data_set_title( pszSharedData, "title"); - CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_data_set_title", WatchfaceComplicationGetError(nRet)); - break; - case WATCHFACE_COMPLICATION_TYPE_LONG_TEXT : - nRet = watchface_complication_provider_data_set_long_text(pszSharedData, "long text"); - CALLBACK_ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_provider_data_set_long_text"); - CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_data_set_long_text", WatchfaceComplicationGetError(nRet)); - nRet = watchface_complication_provider_data_set_extra_data(pszSharedData, "extra data"); - CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_data_set_extra_data", WatchfaceComplicationGetError(nRet)); - break; - case WATCHFACE_COMPLICATION_TYPE_RANGED_VALUE : - nRet = watchface_complication_provider_data_set_ranged_value( - pszSharedData, 50.0, 0.0, 100.0); - CALLBACK_ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_provider_data_set_ranged_value"); - CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_data_set_ranged_value", WatchfaceComplicationGetError(nRet)); - break; - case WATCHFACE_COMPLICATION_TYPE_ICON : - nRet = watchface_complication_provider_data_set_icon_path(pszSharedData, "temp_icon_path"); - CALLBACK_ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_provider_data_set_icon_path"); - CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_data_set_icon_path", WatchfaceComplicationGetError(nRet)); - break; - case WATCHFACE_COMPLICATION_TYPE_IMAGE : - nRet = watchface_complication_provider_data_set_image_path(pszSharedData, "temp_image_path"); - CALLBACK_ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_provider_data_set_image_path"); - CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_data_set_image_path", WatchfaceComplicationGetError(nRet)); - break; - case WATCHFACE_COMPLICATION_TYPE_TIME : - nRet = watchface_complication_provider_data_set_timestamp(pszSharedData, 12345); - CALLBACK_ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_provider_data_set_timestamp"); - CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_data_set_timestamp", WatchfaceComplicationGetError(nRet)); - break; - default : - break; - } - g_bCallBackHit = true; - service_app_exit(); -} - -/** -* @function WatchfaceComplicationProviderDataIsValidCb -* @description Callback Function -* @parameters const char *pszProviderId, const char *pszReqAppid, watchface_complication_type_e eType, const bundle *pszContext, bundle *pszSharedData, void *pszUserData -* @return NA -*/ -static void WatchfaceComplicationProviderDataIsValidCb(const char *pszProviderId, const char *pszReqAppid, watchface_complication_type_e eType, const bundle *pszContext, bundle *pszSharedData, void *pszUserData) -{ - FPRINTF("[Line : %d][%s] %s invoked\\n", __LINE__, API_NAMESPACE, "WatchfaceComplicationProviderDataIsValidCb"); - bool bIsValid = false; - char *pszUserDataChar = (char *)pszUserData; - int nRet; - - if (eType == WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT) - { - nRet = watchface_complication_provider_data_set_short_text(pszSharedData, "short_text"); - CALLBACK_ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_provider_data_set_short_text"); - CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_data_set_short_text", WatchfaceComplicationGetError(nRet)); - - nRet = watchface_complication_provider_data_is_valid(pszSharedData, &bIsValid); - CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_data_is_valid", WatchfaceComplicationGetError(nRet)); - if(bIsValid != true) - { - FPRINTF("[Line : %d][%s] %s failed. bIsValid = false\\n", __LINE__, API_NAMESPACE, "watchface_complication_provider_data_is_valid"); - app_control_destroy(g_hTestControl); - service_app_exit(); - return; - } - - if(strncmp(pszUserDataChar, g_pszCheckUserData, strlen(g_pszCheckUserData)) != 0){ - app_control_destroy(g_hTestControl); - service_app_exit(); - return; - } - g_bCallBackHit = true; - } - app_control_destroy(g_hTestControl); - service_app_exit(); - return; -} - -/** -* @function WatchfaceComplicationProviderSetupReplyToEditorChecker -* @description Helper Function -* @parameters NA -* @return NA -*/ -void WatchfaceComplicationProviderSetupReplyToEditorChecker(void) -{ - bundle *pszContext = bundle_create(); - int nRet = get_last_result(); - PRINT_RESULT_EXIT(nRet, BUNDLE_ERROR_NONE, "bundle_create", BundleGetError(nRet)); - CALLBACK_CHECK_HANDLE_EXIT_CLEANUP(pszContext, "bundle_create", app_control_destroy(g_hTestControl)); - nRet = watchface_complication_provider_setup_reply_to_editor(g_hTestControl, pszContext); - CALLBACK_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_setup_reply_to_editor", WatchfaceComplicationGetError(nRet), bundle_free(pszContext);app_control_destroy(g_hTestControl)); - bundle_free(pszContext); - app_control_destroy(g_hTestControl); - service_app_exit(); - g_bCheckerHit = true; - return; -} - -/** -* @function WatchfaceComplicationProviderSetupIsEditingChecker -* @description Helper Function -* @parameters NA -* @return NA -*/ -void WatchfaceComplicationProviderSetupIsEditingChecker(void) -{ - bool IsEditing = false; - int nRet = watchface_complication_provider_setup_is_editing(g_hTestControl, &IsEditing); - CALLBACK_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_setup_is_editing", WatchfaceComplicationGetError(nRet), app_control_destroy(g_hTestControl)); - if(IsEditing != true) - { - FPRINTF("[Line : %d][%s] %s failed. IsEditing = false\\n", __LINE__, API_NAMESPACE, "watchface_complication_provider_setup_is_editing"); - app_control_destroy(g_hTestControl); - service_app_exit(); - return; - } - app_control_destroy(g_hTestControl); - service_app_exit(); - g_bCheckerHit = true; - return; -} - -/** -* @function WatchfaceComplicationProviderSetupGetContextChecker -* @description Helper Function -* @parameters NA -* @return NA -*/ -void WatchfaceComplicationProviderSetupGetContextChecker(void) -{ - bundle *pszContext = NULL; - int nRet = watchface_complication_provider_setup_get_context(g_hTestControl, &pszContext); - CALLBACK_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_setup_get_context", WatchfaceComplicationGetError(nRet), app_control_destroy(g_hTestControl)); - CALLBACK_CHECK_HANDLE_EXIT_CLEANUP(pszContext, "watchface_complication_provider_setup_get_context", app_control_destroy(g_hTestControl)); - bundle_free(pszContext); - app_control_destroy(g_hTestControl); - service_app_exit(); - g_bCheckerHit = true; - return; -} - -/** -* @function WatchfaceComplicationProviderEventGetTypeChecker -* @description Helper Function -* @parameters NA -* @return NA -*/ -void WatchfaceComplicationProviderEventGetTypeChecker(void) -{ - watchface_complication_event_type_e eEventType = WATCHFACE_COMPLICATION_EVENT_NONE; - int nRet = watchface_complication_provider_event_get_type(g_hTestControl, &eEventType); - CALLBACK_ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_provider_event_get_type"); - CALLBACK_EXIT_CLEANUP(eEventType, WATCHFACE_COMPLICATION_EVENT_TAP, "watchface_complication_provider_event_get_type", WatchfaceComplicationGetError(nRet), app_control_destroy(g_hTestControl)); - if(eEventType < WATCHFACE_COMPLICATION_EVENT_NONE || eEventType > WATCHFACE_COMPLICATION_EVENT_DOUBLE_TAP) - { - FPRINTF("[Line : %d][%s] %s failed. eType = %d\\n", __LINE__, API_NAMESPACE, "watchface_complication_provider_event_get_type", eEventType); - app_control_destroy(g_hTestControl); - service_app_exit(); - return; - } - - g_bCheckerHit = true; - app_control_destroy(g_hTestControl); - service_app_exit(); - return; -} - -/** -* @function WatchfaceComplicationProviderEventGetProviderIdChecker -* @description Helper Function -* @parameters NA -* @return NA -*/ -void WatchfaceComplicationProviderEventGetProviderIdChecker(void) -{ - char *pszProviderId = NULL; - - int nRet = watchface_complication_provider_event_get_provider_id(g_hTestControl, &pszProviderId); - CALLBACK_ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_provider_event_get_provider_id"); - CALLBACK_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_event_get_provider_id", WatchfaceComplicationGetError(nRet), app_control_destroy(g_hTestControl)); - CALLBACK_CHECK_HANDLE_EXIT_CLEANUP(pszProviderId, "watchface_complication_provider_event_get_provider_id", app_control_destroy(g_hTestControl)); - - g_bCheckerHit = true; - app_control_destroy(g_hTestControl); - FREE_MEMORY(pszProviderId); - service_app_exit(); -} - -/** -* @function WatchfaceComplicationProviderEventGetComplicationTypeChecker -* @description Helper Function -* @parameters NA -* @return NA -*/ -void WatchfaceComplicationProviderEventGetComplicationTypeChecker(void) -{ - watchface_complication_type_e eType; - - int nRet = watchface_complication_provider_event_get_complication_type(g_hTestControl, &eType); - CALLBACK_ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_provider_event_get_complication_type"); - CALLBACK_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_event_get_complication_type", WatchfaceComplicationGetError(nRet), app_control_destroy(g_hTestControl)); - if(eType < WATCHFACE_COMPLICATION_TYPE_NO_DATA || eType > WATCHFACE_COMPLICATION_TYPE_IMAGE) - { - FPRINTF("[Line : %d][%s] %s failed. eType = %d\\n", __LINE__, API_NAMESPACE, "watchface_complication_provider_event_complication_type", eType); - app_control_destroy(g_hTestControl); - service_app_exit(); - return; - } - g_bCheckerHit = true; - app_control_destroy(g_hTestControl); - service_app_exit(); -} - -/** -* @function WatchfaceComplicationProviderEventGetContextChecker -* @description Helper Function -* @parameters NA -* @return NA -*/ -void WatchfaceComplicationProviderEventGetContextChecker(void) -{ - watchface_complication_type_e eType; - - int nRet = watchface_complication_provider_event_get_complication_type(g_hTestControl, &eType); - CALLBACK_ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_provider_event_get_complication_type"); - CALLBACK_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_event_get_context", WatchfaceComplicationGetError(nRet), app_control_destroy(g_hTestControl)); - if(eType < WATCHFACE_COMPLICATION_TYPE_NO_DATA || eType > WATCHFACE_COMPLICATION_TYPE_IMAGE) - { - FPRINTF("[Line : %d][%s] %s failed. eType = %d\\n", __LINE__, API_NAMESPACE, "watchface_complication_provider_event_get_complication_type", eType); - app_control_destroy(g_hTestControl); - service_app_exit(); - return; - } - g_bCheckerHit = true; - app_control_destroy(g_hTestControl); - service_app_exit(); -} - -/*****************************************************Helper Functions End*****************************************************/ - -//& purpose: To add and remove the callback function to be executed when the update requested -//& type: auto -/** -* @testcase ITc_watchface_complication_provider_add_remove_update_requested_cb_p -* @since_tizen 5.0 -* @author SRID(karanam.s) -* @reviewer SRID(manoj.g2) -* @type auto -* @description Add and remove the callback function to be executed when the update requested. -* @scenario Add and remove the callback function to be executed when the update requested. -* @apicovered watchface_complication_provider_add_update_requested_cb, watchface_complication_provider_remove_update_requested_cb -* @passcase When add and remove requested cb returns 0 -* @failcase When either of add and remove requested cb returns 1 -* @precondition N/A -* @postcondition N/A -* */ -int ITc_watchface_complication_provider_add_remove_update_requested_cb_p(void) -{ - START_TEST; - int nRet = watchface_complication_provider_add_update_requested_cb(PROVIDER_ID, ComplicationProviderUpdateRequestedCb, NULL); - ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_provider_add_update_requested_cb"); - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_add_update_requested_cb", WatchfaceComplicationGetError(nRet)); - - nRet = watchface_complication_provider_remove_update_requested_cb(PROVIDER_ID, ComplicationProviderUpdateRequestedCb); - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_remove_update_requested_cb", WatchfaceComplicationGetError(nRet)); - - service_app_exit(); - return 0; -} - -//& purpose: To notify to the complication that there is an update -//& type: auto -/** -* @testcase ITc_watchface_complication_provider_notify_update_p -* @since_tizen 5.0 -* @author SRID(karanam.s) -* @reviewer SRID(manoj.g2) -* @type auto -* @description Notifys to the complication that there is an update. -* @scenario Complication automatically requests data when notify is received. -* @apicovered watchface_complication_provider_notify_update -* @passcase watchface_complication_provider_notify_update returns 0 -* @failcase watchface_complication_provider_notify_update returns 1 -* @precondition N/A -* @postcondition N/A -* */ -int ITc_watchface_complication_provider_notify_update_p(void) -{ - START_TEST; - g_bCallBackHit = false; - int nRet = watchface_complication_provider_add_update_requested_cb(PROVIDER_ID, ComplicationProviderUpdateRequestedCb, NULL); - ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_provider_add_update_requested_cb"); - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_add_update_requested_cb", WatchfaceComplicationGetError(nRet)); - - nWatchfaceId = nWatchfaceId + 1; - RunApp(COMPLICATION_TEST_APP, "COMP_TYPE", "SHORT_TEXT", nWatchfaceId); - - nRet = watchface_complication_provider_notify_update(PROVIDER_ID); - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_notify_update", WatchfaceComplicationGetError(nRet)); - - IterateGmainLoop(); - if(!g_bCallBackHit) - { - FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "ComplicationProviderUpdateRequestedCb"); - nRet = watchface_complication_provider_remove_update_requested_cb(PROVIDER_ID, ComplicationProviderUpdateRequestedCb); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_remove_update_requested_cb", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 1; - } - - nRet = watchface_complication_provider_remove_update_requested_cb(PROVIDER_ID, ComplicationProviderUpdateRequestedCb); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_remove_update_requested_cb", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 0; -} - -//& purpose: To send reply to the editor -//& type: auto -/** -* @testcase ITc_watchface_complication_provider_setup_reply_to_editor_p -* @since_tizen 5.0 -* @author SRID(karanam.s) -* @reviewer SRID(manoj.g2) -* @type auto -* @description Sends reply to the editor. -* @scenario Using this function, setup app can sends new context data to the editor -* @apicovered watchface_complication_provider_setup_reply_to_editor -* @passcase watchface_complication_provider_setup_reply_to_editor returns 0 -* @failcase watchface_complication_provider_setup_reply_to_editor returns 1 -* @precondition N/A -* @postcondition N/A -* */ -int ITc_watchface_complication_provider_setup_reply_to_editor_p(void) -{ - START_TEST; - g_bCallBackHit = false; - g_bCheckerHit = false; - - int nRet = watchface_editable_add_edit_ready_cb(SetupOnEditReadyCb, NULL); - if(g_bFeatureNotSupported) - return 0; - if(g_bIsFeatureMismatched) - return 1; - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_add_edit_ready_cb", WatchfaceComplicationGetError(nRet)); - - nWatchfaceId++; - RunApp(EDITOR_ID, EDITOR_CMD_KEY, SETUP_REPLY_TO_EDITOR_TEST_VAL, nWatchfaceId); - - IterateGmainLoop(); - if(!g_bCheckerHit) - { - nRet = watchface_editable_remove_edit_ready_cb(SetupOnEditReadyCb); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 1; - } - if(!g_bCallBackHit) - { - FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "SetupOnEditReadyCb"); - nRet = watchface_editable_remove_edit_ready_cb(SetupOnEditReadyCb); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 1; - } - - nRet = watchface_editable_remove_edit_ready_cb(SetupOnEditReadyCb); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 0; -} - -//& purpose: To check whether watch app request editing or not -//& type: auto -/** -* @testcase ITc_watchface_complication_provider_setup_is_editing_p -* @since_tizen 5.0 -* @author SRID(karanam.s) -* @reviewer SRID(manoj.g2) -* @type auto -* @description Checks whether watch app request editing or not. -* @scenario Using this function, setup app can tell what kind of UI should be displayed. -* @apicovered watchface_complication_provider_setup_is_editing -* @passcase watchface_complication_provider_setup_is_editing returns 0 -* @failcase watchface_complication_provider_setup_is_editing returns 1 -* @precondition N/A -* @postcondition N/A -* */ -int ITc_watchface_complication_provider_setup_is_editing_p(void) -{ - START_TEST; - g_bCallBackHit = false; - g_bCheckerHit = false; - - int nRet = watchface_editable_add_edit_ready_cb(SetupOnEditReadyCb, NULL); - if(g_bFeatureNotSupported) - return 0; - if(g_bIsFeatureMismatched) - return 1; - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_add_edit_ready_cb", WatchfaceComplicationGetError(nRet)); - - nWatchfaceId++; - RunApp(EDITOR_ID, EDITOR_CMD_KEY, SETUP_IS_EDITING_TEST_VAL, nWatchfaceId); - - IterateGmainLoop(); - if(!g_bCheckerHit) - { - nRet = watchface_editable_remove_edit_ready_cb(SetupOnEditReadyCb); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 1; - } - if(!g_bCallBackHit) - { - FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "SetupOnEditReadyCb"); - nRet = watchface_editable_remove_edit_ready_cb(SetupOnEditReadyCb); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 1; - } - nRet = watchface_editable_remove_edit_ready_cb(SetupOnEditReadyCb); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 0; -} - -//& purpose: To get provider app's setup context data -//& type: auto -/** -* @testcase ITc_watchface_complication_provider_setup_get_context_p -* @since_tizen 5.0 -* @author SRID(karanam.s) -* @reviewer SRID(manoj.g2) -* @type auto -* @description Gets provider app's setup context data. -* @scenario Context data will be passed to the complication provider application. -* @apicovered watchface_complication_provider_setup_get_context -* @passcase watchface_complication_provider_setup_get_context returns 0 -* @failcase watchface_complication_provider_setup_get_context returns 1 -* @precondition N/A -* @postcondition N/A -* */ -int ITc_watchface_complication_provider_setup_get_context_p(void) -{ - START_TEST; - g_bCallBackHit = false; - int nRet = watchface_editable_add_edit_ready_cb(SetupOnEditReadyCb, NULL); - if(g_bFeatureNotSupported) - return 0; - if(g_bIsFeatureMismatched) - return 1; - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_add_edit_ready_cb", WatchfaceComplicationGetError(nRet)); - - nWatchfaceId++; - RunApp(EDITOR_ID, EDITOR_CMD_KEY, SETUP_GET_CONTEXT_TEST_VAL, nWatchfaceId); - - IterateGmainLoop(); - if(!g_bCheckerHit) - { - watchface_editable_remove_edit_ready_cb(SetupOnEditReadyCb); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 1; - } - if(!g_bCallBackHit) - { - FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "SetupOnEditReadyCb"); - nRet = watchface_editable_remove_edit_ready_cb(SetupOnEditReadyCb); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 1; - } - nRet = watchface_editable_remove_edit_ready_cb(SetupOnEditReadyCb); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 0; -} - -//& purpose: To set short text data for shared data -//& type: auto -/** -* @testcase ITc_watchface_complication_provider_data_set_short_text_p -* @since_tizen 5.0 -* @author SRID(karanam.s) -* @reviewer SRID(manoj.g2) -* @type auto -* @description Sets short text data for shared data. -* @scenario Sets short text data for shared data. -* @apicovered watchface_complication_provider_data_set_short_text -* @passcase watchface_complication_provider_data_set_short_text returns 0 -* @failcase watchface_complication_provider_data_set_short_text returns 1 -* @precondition N/A -* @postcondition N/A -* */ -int ITc_watchface_complication_provider_data_set_short_text_p(void) -{ - START_TEST; - int nRet = watchface_complication_provider_add_update_requested_cb(PROVIDER_ID, UpdateRequestedCb2, NULL); - if(g_bFeatureNotSupported) - return 0; - if(g_bIsFeatureMismatched) - return 1; - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_add_update_requested_cb", WatchfaceComplicationGetError(nRet)); - g_bCallBackHit = false; - nWatchfaceId++; - RunApp(COMPLICATION_TEST_APP, "COMP_TYPE", "SHORT_TEXT", nWatchfaceId); - - IterateGmainLoop(); - if(!g_bCallBackHit) - { - FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "UpdateRequestedCb2"); - nRet = watchface_complication_provider_remove_update_requested_cb(PROVIDER_ID, UpdateRequestedCb2); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_remove_update_requested_cb", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 1; - } - nRet = watchface_complication_provider_remove_update_requested_cb(PROVIDER_ID, UpdateRequestedCb2); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_remove_update_requested_cb", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 0; -} - -//& purpose: To set long text data for shared data -//& type: auto -/** -* @testcase ITc_watchface_complication_provider_data_set_long_text_p -* @since_tizen 5.0 -* @author SRID(karanam.s) -* @reviewer SRID(manoj.g2) -* @type auto -* @description Sets long text data for shared data. -* @scenario Sets long text data for shared data. -* @apicovered watchface_complication_provider_data_set_long_text -* @passcase watchface_complication_provider_data_set_long_text returns 0 -* @failcase watchface_complication_provider_data_set_long_text returns 1 -* @precondition N/A -* @postcondition N/A -* */ -int ITc_watchface_complication_provider_data_set_long_text_p(void) -{ - START_TEST; - g_bCallBackHit = false; - int nRet = watchface_complication_provider_add_update_requested_cb(PROVIDER_ID, UpdateRequestedCb2, NULL); - if(g_bFeatureNotSupported) - return 0; - if(g_bIsFeatureMismatched) - return 1; - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_add_update_requested_cb", WatchfaceComplicationGetError(nRet)); - - nWatchfaceId++; - RunApp(COMPLICATION_TEST_APP, "COMP_TYPE", "LONG_TEXT", nWatchfaceId); - IterateGmainLoop(); - if(!g_bCallBackHit) - { - FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "UpdateRequestedCb2"); - nRet = watchface_complication_provider_remove_update_requested_cb(PROVIDER_ID, UpdateRequestedCb2); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_remove_update_requested_cb", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 1; - } - nRet = watchface_complication_provider_remove_update_requested_cb(PROVIDER_ID, UpdateRequestedCb2); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_remove_update_requested_cb", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 0; -} - -//& purpose: To set title data for shared data -//& type: auto -/** -* @testcase ITc_watchface_complication_provider_data_set_title_p -* @since_tizen 5.0 -* @author SRID(karanam.s) -* @reviewer SRID(manoj.g2) -* @type auto -* @description Sets title data for shared data. -* @scenario Sets title data for shared data. -* @apicovered watchface_complication_provider_data_set_title -* @passcase watchface_complication_provider_data_set_title returns 0 -* @failcase watchface_complication_provider_data_set_title returns 1 -* @precondition N/A -* @postcondition N/A -* */ -int ITc_watchface_complication_provider_data_set_title_p(void) -{ - START_TEST; - int nRet = watchface_complication_provider_add_update_requested_cb(PROVIDER_ID, UpdateRequestedCb2, NULL); - if(g_bFeatureNotSupported) - return 0; - if(g_bIsFeatureMismatched) - return 1; - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_add_update_requested_cb", WatchfaceComplicationGetError(nRet)); - g_bCallBackHit = false; - nWatchfaceId++; - RunApp(COMPLICATION_TEST_APP, "COMP_TYPE", "SHORT_TEXT", nWatchfaceId); - - IterateGmainLoop(); - if(!g_bCallBackHit) - { - FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "UpdateRequestedCb2"); - nRet = watchface_complication_provider_remove_update_requested_cb(PROVIDER_ID, UpdateRequestedCb2); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_remove_update_requested_cb", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 1; - } - nRet = watchface_complication_provider_remove_update_requested_cb(PROVIDER_ID, UpdateRequestedCb2); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_remove_update_requested_cb", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 0; -} - -//& purpose: To set timestamp data for shared data -//& type: auto -/** -* @testcase ITc_watchface_complication_provider_data_set_timestamp_p -* @since_tizen 5.0 -* @author SRID(karanam.s) -* @reviewer SRID(manoj.g2) -* @type auto -* @description Sets timestamp data for shared data. -* @scenario Sets timestamp data for shared data. -* @apicovered watchface_complication_provider_data_set_timestamp -* @passcase watchface_complication_provider_data_set_timestamp returns 0 -* @failcase watchface_complication_provider_data_set_timestamp returns 1 -* @precondition N/A -* @postcondition N/A -* */ -int ITc_watchface_complication_provider_data_set_timestamp_p(void) -{ - START_TEST; - int nRet = watchface_complication_provider_add_update_requested_cb(PROVIDER_ID, UpdateRequestedCb2, NULL); - if(g_bFeatureNotSupported) - return 0; - if(g_bIsFeatureMismatched) - return 1; - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_add_update_requested_cb", WatchfaceComplicationGetError(nRet)); - - g_bCallBackHit = false; - nWatchfaceId++; - RunApp(COMPLICATION_TEST_APP, "COMP_TYPE", "TIME", nWatchfaceId); - - IterateGmainLoop(); - if(!g_bCallBackHit) - { - FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "UpdateRequestedCb2"); - nRet = watchface_complication_provider_remove_update_requested_cb(PROVIDER_ID, UpdateRequestedCb2); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_remove_update_requested_cb", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 1; - } - nRet = watchface_complication_provider_remove_update_requested_cb(PROVIDER_ID, UpdateRequestedCb2); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_remove_update_requested_cb", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 0; -} - -//& purpose: To set image path data for shared data -//& type: auto -/** -* @testcase ITc_watchface_complication_provider_data_set_image_path_p -* @since_tizen 5.0 -* @author SRID(karanam.s) -* @reviewer SRID(manoj.g2) -* @type auto -* @description Sets image path data for shared data. -* @scenario Sets image path data for shared data. -* @apicovered watchface_complication_provider_data_set_image_path -* @passcase watchface_complication_provider_data_set_image_path returns 0 -* @failcase watchface_complication_provider_data_set_image_path returns 1 -* @precondition N/A -* @postcondition N/A -* */ -int ITc_watchface_complication_provider_data_set_image_path_p(void) -{ - START_TEST; - int nRet = watchface_complication_provider_add_update_requested_cb(PROVIDER_ID, UpdateRequestedCb2, NULL); - if(g_bFeatureNotSupported) - return 0; - if(g_bIsFeatureMismatched) - return 1; - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_add_update_requested_cb", WatchfaceComplicationGetError(nRet)); - g_bCallBackHit = false; - nWatchfaceId++; - RunApp(COMPLICATION_TEST_APP, "COMP_TYPE", "IMAGE", nWatchfaceId); - - IterateGmainLoop(); - if(!g_bCallBackHit) - { - FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "UpdateRequestedCb2"); - nRet = watchface_complication_provider_remove_update_requested_cb(PROVIDER_ID, UpdateRequestedCb2); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_remove_update_requested_cb", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 1; - } - nRet = watchface_complication_provider_remove_update_requested_cb(PROVIDER_ID, UpdateRequestedCb2); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_remove_update_requested_cb", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 0; -} - -//& purpose: To set ranged value data for shared data -//& type: auto -/** -* @testcase ITc_watchface_complication_provider_data_set_ranged_value_p -* @since_tizen 5.0 -* @author SRID(karanam.s) -* @reviewer SRID(manoj.g2) -* @type auto -* @description Sets ranged value data for shared data. -* @scenario Sets ranged value data for shared data. -* @apicovered watchface_complication_provider_data_set_ranged_value -* @passcase watchface_complication_provider_data_set_ranged_value returns 0 -* @failcase watchface_complication_provider_data_set_ranged_value returns 1 -* @precondition N/A -* @postcondition N/A -* */ -int ITc_watchface_complication_provider_data_set_ranged_value_p(void) -{ - START_TEST; - int nRet = watchface_complication_provider_add_update_requested_cb(PROVIDER_ID, UpdateRequestedCb2, NULL); - if(g_bFeatureNotSupported) - return 0; - if(g_bIsFeatureMismatched) - return 1; - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_add_update_requested_cb", WatchfaceComplicationGetError(nRet)); - g_bCallBackHit = false; - nWatchfaceId++; - RunApp(COMPLICATION_TEST_APP, "COMP_TYPE", "RANGED_VALUE", nWatchfaceId); - - IterateGmainLoop(); - if(!g_bCallBackHit) - { - FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "UpdateRequestedCb2"); - nRet = watchface_complication_provider_remove_update_requested_cb(PROVIDER_ID, UpdateRequestedCb2); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_remove_update_requested_cb", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 1; - } - nRet = watchface_complication_provider_remove_update_requested_cb(PROVIDER_ID, UpdateRequestedCb2); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_remove_update_requested_cb", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 0; -} - -//& purpose: To set icon path data for shared data -//& type: auto -/** -* @testcase ITc_watchface_complication_provider_data_set_icon_path_p -* @since_tizen 5.0 -* @author SRID(karanam.s) -* @reviewer SRID(manoj.g2) -* @type auto -* @description Sets icon path data for shared data. -* @scenario Sets icon path data for shared data. -* @apicovered watchface_complication_provider_data_set_icon_path -* @passcase watchface_complication_provider_data_set_icon_path returns 0 -* @failcase watchface_complication_provider_data_set_icon_path returns 1 -* @precondition N/A -* @postcondition N/A -* */ -int ITc_watchface_complication_provider_data_set_icon_path_p(void) -{ - START_TEST; - int nRet = watchface_complication_provider_add_update_requested_cb(PROVIDER_ID, UpdateRequestedCb2, NULL); - if(g_bFeatureNotSupported) - return 0; - if(g_bIsFeatureMismatched) - return 1; - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_add_update_requested_cb", WatchfaceComplicationGetError(nRet)); - g_bCallBackHit = false; - nWatchfaceId++; - RunApp(COMPLICATION_TEST_APP, "COMP_TYPE", "ICON", nWatchfaceId); - IterateGmainLoop(); - if(!g_bCallBackHit) - { - FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "UpdateRequestedCb2"); - nRet = watchface_complication_provider_remove_update_requested_cb(PROVIDER_ID, UpdateRequestedCb2); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_remove_update_requested_cb", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 1; - } - nRet = watchface_complication_provider_remove_update_requested_cb(PROVIDER_ID, UpdateRequestedCb2); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_remove_update_requested_cb", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 0; -} - -//& purpose: To set extra data for shared data -//& type: auto -/** -* @testcase ITc_watchface_complication_provider_data_set_extra_data_p -* @since_tizen 5.0 -* @author SRID(karanam.s) -* @reviewer SRID(manoj.g2) -* @type auto -* @description Sets extra data for shared data. -* @scenario Sets extra data for shared data. -* @apicovered watchface_complication_provider_data_set_extra_data -* @passcase watchface_complication_provider_data_set_extra_data returns 0 -* @failcase watchface_complication_provider_data_set_extra_data returns 1 -* @precondition N/A -* @postcondition N/A -* */ -int ITc_watchface_complication_provider_data_set_extra_data_p(void) -{ - START_TEST; - int nRet = watchface_complication_provider_add_update_requested_cb(PROVIDER_ID, UpdateRequestedCb2, NULL); - if(g_bFeatureNotSupported) - return 0; - if(g_bIsFeatureMismatched) - return 1; - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_add_update_requested_cb", WatchfaceComplicationGetError(nRet)); - g_bCallBackHit = false; - nWatchfaceId = nWatchfaceId + 1; - RunApp(COMPLICATION_TEST_APP, "COMP_TYPE", "LONG_TEXT", nWatchfaceId); - IterateGmainLoop(); - if(!g_bCallBackHit) - { - FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "UpdateRequestedCb2"); - nRet = watchface_complication_provider_remove_update_requested_cb(PROVIDER_ID, UpdateRequestedCb2); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_remove_update_requested_cb", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 1; - } - nRet = watchface_complication_provider_remove_update_requested_cb(PROVIDER_ID, UpdateRequestedCb2); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_remove_update_requested_cb", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 0; -} - -//& purpose: To get touch event type that is transferred from watchface -//& type: auto -/** -* @testcase ITc_watchface_complication_provider_event_get_type_p -* @since_tizen 5.0 -* @author SRID(karanam.s) -* @reviewer SRID(manoj.g2) -* @type auto -* @description Gets touch event type that is transferred from watchface. -* @scenario Gets touch event type that is transferred from watchface. -* @apicovered watchface_complication_provider_event_get_type -* @passcase watchface_complication_provider_event_get_type returns 0 -* @failcase watchface_complication_provider_event_get_type returns 1 -* @precondition N/A -* @postcondition N/A -* */ -int ITc_watchface_complication_provider_event_get_type_p(void) -{ - START_TEST; - g_bCheckerHit = false; - g_pszEventCmd = EVENT_GET_EVENT_TYPE_TEST_VAL; - nWatchfaceId = nWatchfaceId + 1; - RunApp(COMPLICATION_TEST_APP, "EVENT_TEST", EVENT_GET_EVENT_TYPE_TEST_VAL, nWatchfaceId); - if(g_bFeatureNotSupported) - return 0; - if(g_bIsFeatureMismatched) - return 1; - IterateGmainLoop(); - - if(!g_bCheckerHit) - { - service_app_exit(); - return 1; - } - service_app_exit(); - return 0; -} - -//& purpose: To get provider id of touched complication -//& type: auto -/** -* @testcase ITc_watchface_complication_provider_event_get_provider_id_p -* @since_tizen 5.0 -* @author SRID(karanam.s) -* @reviewer SRID(manoj.g2) -* @type auto -* @description Gets provider id of touched complication. -* @scenario Gets provider id of touched complication. -* @apicovered watchface_complication_provider_event_get_provider_id -* @passcase watchface_complication_provider_event_get_provider_id returns 0 -* @failcase watchface_complication_provider_event_get_provider_id returns 1 -* @precondition N/A -* @postcondition N/A -* */ -int ITc_watchface_complication_provider_event_get_provider_id_p(void) -{ - START_TEST; - g_bCheckerHit = false; - g_pszEventCmd = EVENT_GET_PROVIDER_ID_TEST_VAL; - nWatchfaceId = nWatchfaceId + 1; - RunApp(COMPLICATION_TEST_APP, "EVENT_TEST", EVENT_GET_PROVIDER_ID_TEST_VAL, nWatchfaceId); - if(g_bFeatureNotSupported) - return 0; - if(g_bIsFeatureMismatched) - return 1; - - IterateGmainLoop(); - if(!g_bCheckerHit) - { - return 1; - } - return 0; -} - -//& purpose: To get complication type of touched complication -//& type: auto -/** -* @testcase ITc_watchface_complication_provider_event_get_complication_type_p -* @since_tizen 5.0 -* @author SRID(karanam.s) -* @reviewer SRID(manoj.g2) -* @type auto -* @description Gets complication type of touched complication. -* @scenario Gets complication type of touched complication. -* @apicovered watchface_complication_provider_event_get_complication_type -* @passcase watchface_complication_provider_event_get_complication_type returns 0 -* @failcase watchface_complication_provider_event_get_complication_type returns 1 -* @precondition N/A -* @postcondition N/A -* */ -int ITc_watchface_complication_provider_event_get_complication_type_p(void) -{ - START_TEST; - g_bCheckerHit = false; - g_pszEventCmd = EVENT_GET_COMP_TYPE_TEST_VAL; - nWatchfaceId = nWatchfaceId + 1; - RunApp(COMPLICATION_TEST_APP, "EVENT_TEST", EVENT_GET_COMP_TYPE_TEST_VAL, nWatchfaceId); - if(g_bFeatureNotSupported) - return 0; - if(g_bIsFeatureMismatched) - return 1; - - IterateGmainLoop(); - if(!g_bCheckerHit) - { - return 1; - } - return 0; -} - -//& purpose: To get complication context of touched complication -//& type: auto -/** -* @testcase ITc_watchface_complication_provider_event_get_context_p -* @since_tizen 5.0 -* @author SRID(karanam.s) -* @reviewer SRID(manoj.g2) -* @type auto -* @description Gets complication context of touched complication. -* @scenario Gets complication context of touched complication. -* @apicovered watchface_complication_provider_event_get_context -* @passcase watchface_complication_provider_event_get_context returns 0 -* @failcase watchface_complication_provider_event_get_context returns 1 -* @precondition N/A -* @postcondition N/A -* */ -int ITc_watchface_complication_provider_event_get_context_p(void) -{ - START_TEST; - g_bCheckerHit = false; - g_pszEventCmd = EVENT_GET_CONTEXT_TEST_VAL; - nWatchfaceId = nWatchfaceId + 1; - RunApp(COMPLICATION_TEST_APP, "EVENT_TEST", EVENT_GET_CONTEXT_TEST_VAL, nWatchfaceId); - if(g_bFeatureNotSupported) - return 0; - if(g_bIsFeatureMismatched) - return 1; - - IterateGmainLoop(); - if(!g_bCheckerHit) - { - return 1; - } - return 0; -} - -//& purpose: To set screen reader text for shared data -//& type: auto -/** -* @testcase ITc_watchface_complication_provider_data_set_screen_reader_text_p -* @since_tizen 5.0 -* @author SRID(karanam.s) -* @reviewer SRID(manoj.g2) -* @type auto -* @description Sets screen reader text for shared data. -* @scenario Sets screen reader text for shared data. -* @apicovered watchface_complication_provider_data_set_screen_reader_text -* @passcase watchface_complication_provider_data_set_screen_reader_text returns 0 -* @failcase watchface_complication_provider_data_set_screen_reader_text returns 1 -* @precondition N/A -* @postcondition N/A -* */ -int ITc_watchface_complication_provider_data_set_screen_reader_text_p(void) -{ - START_TEST; - bundle *pszSharedData = bundle_create(); - int nRet = get_last_result(); - PRINT_RESULT_EXIT(nRet, BUNDLE_ERROR_NONE, "bundle_create", BundleGetError(nRet)); - CALLBACK_CHECK_HANDLE_EXIT_CLEANUP(pszSharedData, "bundle_create", app_control_destroy(g_hTestControl)); - nRet = watchface_complication_provider_data_set_screen_reader_text(pszSharedData, "screen_reader_text test"); - ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_provider_data_set_screen_reader_text"); - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_data_set_screen_reader_text", WatchfaceComplicationGetError(nRet)); - - bundle_free(pszSharedData); - service_app_exit(); - return 0; -} - -//& purpose: To check whether shared data is valid or not -//& type: auto -/** -* @testcase ITc_watchface_complication_provider_data_is_valid_p -* @since_tizen 5.0 -* @author SRID(karanam.s) -* @reviewer SRID(manoj.g2) -* @type auto -* @description Check whether shared data is valid or not. -* @scenario Check whether shared data is valid or not. -* @apicovered ITc_watchface_complication_provider_data_is_valid_p -* @passcase ITc_watchface_complication_provider_data_is_valid_p returns 0 -* @failcase ITc_watchface_complication_provider_data_is_valid_p returns 1 -* @precondition N/A -* @postcondition N/A -* */ -int ITc_watchface_complication_provider_data_is_valid_p(void) -{ - START_TEST; - g_bCallBackHit = false; - int nRet = watchface_complication_provider_add_update_requested_cb(PROVIDER_ID, WatchfaceComplicationProviderDataIsValidCb, g_pszCheckUserData); - if(g_bFeatureNotSupported) - return 0; - if(g_bIsFeatureMismatched) - return 1; - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_data_is_valid", WatchfaceComplicationGetError(nRet)); - - RunApp(COMPLICATION_TEST_APP, "COMP_TYPE", "SHORT_TEXT", DATAISVALIDID); - IterateGmainLoop(); - - if(!g_bCallBackHit) - { - FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "WatchfaceComplicationProviderDataIsValidCb"); - nRet = watchface_complication_provider_remove_update_requested_cb(PROVIDER_ID, WatchfaceComplicationProviderDataIsValidCb); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_remove_update_requested_cb", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 1; - } - - nRet = watchface_complication_provider_remove_update_requested_cb(PROVIDER_ID, WatchfaceComplicationProviderDataIsValidCb); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_provider_remove_update_requested_cb", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 0; -} diff --git a/src/itc/watchface/ITs-watchface-complication.c b/src/itc/watchface/ITs-watchface-complication.c deleted file mode 100755 index aff0469fb..000000000 --- a/src/itc/watchface/ITs-watchface-complication.c +++ /dev/null @@ -1,1317 +0,0 @@ -// -// Copyright (c) 2018 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 -#include -#include -#include -#include -#include "ITs-watchface-common.h" -#define PROVIDER_ID "org.tizen.watchface_sample_provider/test" -static int nComplicatoinId = 1; - -/** @addtogroup itc-watchface -* @ingroup itc -* @{ -*/ - - -//& set: watchface - -/** -* @function ITs_watchface_complication_startup -* @description Called before each test, set the service boolean true -* @parameter NA -* @nReturn NA -*/ -void ITs_watchface_complication_startup(void) -{ -#if DEBUG - FPRINTF("[Line : %d][%s] TEST SUIT start-up: ITs_Watchface_Complication_p\\n", __LINE__, API_NAMESPACE); -#endif - g_bWatchApp = TCTCheckSystemInfoFeatureSupported(FEATURE_WATCH_APP, API_NAMESPACE); - g_bFeatureNotSupported = false; - g_bIsFeatureMismatched = false; - return; -} - -/** -* @function ITs_watchface_complication_cleanup -* @description Called after each test -* @parameter NA -* @nReturn NA -*/ -void ITs_watchface_complication_cleanup(void) -{ -#if DEBUG - FPRINTF("[Line : %d][%s] TEST SUIT clean-up: ITs_Watchface_Complication_p\\n", __LINE__, API_NAMESPACE); -#endif - return; -} -/****************************************************Callback Start****************************************************/ - -/** -* @function WatchfaceComplicationUpdatedCb -* @description Callback Function -* @parameters int nComplicationId, const char *pszProviderId, watchface_complication_type_e eType, const bundle *pszData, void *pszUserData -* @return NA -*/ -static void WatchfaceComplicationUpdatedCb(int nComplicationId, const char *pszProviderId, watchface_complication_type_e eType, const bundle *pszData, void *pszUserData) -{ - FPRINTF("[Line : %d][%s] %s invoked\\n", __LINE__, API_NAMESPACE, "WatchfaceComplicationUpdatedCb"); - g_bCallBackHit = true; - return; -} - -/** -* @function WatchfaceEditableUpdateRequestedCb -* @description Callback Function -* @parameters const watchface_editable_h hHandle, int nSelectedIdx, const watchface_editable_edit_state_e eState, void *pszUserData -* @return NA -*/ -static void WatchfaceEditableUpdateRequestedCb(const watchface_editable_h hHandle, int nSelectedIdx, const watchface_editable_edit_state_e eState, void *pszUserData) -{ - FPRINTF("[Line : %d][%s] %s invoked\\n", __LINE__, API_NAMESPACE, "WatchfaceEditableUpdateRequestedCb"); - g_bCallBackHit = true; - return; -} - -/** -* @function WatchfaceComplicationProviderUpdateRequestedCb -* @description Callback Function -* @parameters const char *pszProviderId, const char *pszReqAppid, watchface_complication_type_e eType, const bundle *pszContext, bundle *pszShareData, void *pszUserData -* @return NA -*/ -static void WatchfaceComplicationProviderUpdateRequestedCb(const char *pszProviderId, const char *pszReqAppid, watchface_complication_type_e eType, const bundle *pszContext, bundle *pszShareData, void *pszUserData) -{ - FPRINTF("[Line : %d][%s] %s invoked\\n", __LINE__, API_NAMESPACE, "WatchfaceComplicationProviderUpdateRequestedCb"); - g_bCallBackHit = true; - return; -} - -/** -* @function WatchfaceComplicationErrorCb -* @description Callback Function -* @parameters int nComplicationId,const char *pszProviderId,watchface_complication_type_e eType,watchface_complication_error_e eError,void *pszUserData -* @return NA -*/ -static void WatchfaceComplicationErrorCb(int nComplicationId, const char *pszProviderId,watchface_complication_type_e eType,watchface_complication_error_e eError,void *pszUserData) -{ - FPRINTF("[Line : %d][%s] %s invoked\\n", __LINE__, API_NAMESPACE, "WatchfaceComplicationErrorCb"); - g_bCallBackHit = true; - return; -} - -/** -* @function TypeComplicationUpdatedCb -* @description Callback Function -* @parameters int nComplicationId,const char *pszProviderId,watchface_complication_type_e eType,const bundle *pszData, void *pszUserData -* @return NA -*/ - -static void TypeComplicationUpdatedCb(int nComplicationId,const char *pszProviderId,watchface_complication_type_e eType,const bundle *pszData, void *pszUserData) -{ - char *pszText; - watchface_complication_type_e eDataType; - int nRet; - - FPRINTF("[Line : %d][%s] %s invoked\\n", __LINE__, API_NAMESPACE, "TypeComplicationUpdatedCb"); - nRet = watchface_complication_data_get_type(pszData, &eDataType); - CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_data_get_type", WatchfaceComplicationGetError(nRet)); - if( eDataType < WATCHFACE_COMPLICATION_TYPE_NO_DATA || eDataType > WATCHFACE_COMPLICATION_TYPE_IMAGE ) - { - FPRINTF("[Line : %d][%s] %s failed. eDataType = %d\\n", __LINE__, API_NAMESPACE, "watchface_complication_data_get_type", eDataType); - service_app_exit(); - return; - } - - g_bCallBackHit = true; - service_app_exit(); - return; -} - -/** -* @function ShortTextComplicationUpdatedCb -* @description Callback Function -* @parameters int nComplicationId,const char *pszProviderId,watchface_complication_type_e eType,const bundle *pszData, void *pszUserData -* @return NA -*/ -static void ShortTextComplicationUpdatedCb(int nComplicationId,const char *pszProviderId,watchface_complication_type_e eType,const bundle *pszData, void *pszUserData) -{ - char *pszText = NULL; - FPRINTF("[Line : %d][%s] %s invoked\\n", __LINE__, API_NAMESPACE, "ShortTextComplicationUpdatedCb"); - int nRet = watchface_complication_data_get_short_text(pszData, &pszText); - CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_data_get_short_text", WatchfaceComplicationGetError(nRet)); - CALLBACK_CHECK_HANDLE_EXIT(pszText, "watchface_complication_data_get_short_text"); - - FREE_MEMORY(pszText); - g_bCallBackHit = true; - service_app_exit(); - return; -} - -/** -* @function LongTextComplicationUpdatedCb -* @description Callback Function -* @parameters int nComplicationId,const char *pszProviderId,watchface_complication_type_e eType,const bundle *pszData, void *pszUserData -* @return NA -*/ -static void LongTextComplicationUpdatedCb(int nComplicationId,const char *pszProviderId,watchface_complication_type_e eType,const bundle *pszData, void *pszUserData) -{ - char *pszText = NULL; - FPRINTF("[Line : %d][%s] %s invoked\\n", __LINE__, API_NAMESPACE, "LongTextComplicationUpdatedCb"); - int nRet = watchface_complication_data_get_long_text(pszData, &pszText); - CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_data_get_long_text", WatchfaceComplicationGetError(nRet)); - CALLBACK_CHECK_HANDLE_EXIT(pszText, "watchface_complication_data_get_long_text"); - FREE_MEMORY(pszText); - - g_bCallBackHit = true; - service_app_exit(); - return; -} - -/** -* @function TitleComplicationUpdatedCb -* @description Callback Function -* @parameters int nComplicationId,const char *pszProviderId,watchface_complication_type_e eType,const bundle *pszData, void *pszUserData -* @return NA -*/ -static void TitleComplicationUpdatedCb(int nComplicationId,const char *pszProviderId,watchface_complication_type_e eType,const bundle *pszData, void *pszUserData) -{ - char *pszText = NULL; - FPRINTF("[Line : %d][%s] %s invoked\\n", __LINE__, API_NAMESPACE, "TitleComplicationUpdatedCb"); - int nRet = watchface_complication_data_get_title(pszData, &pszText); - CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_data_get_title", WatchfaceComplicationGetError(nRet)); - CALLBACK_CHECK_HANDLE_EXIT(pszText, "watchface_complication_data_get_title"); - FREE_MEMORY(pszText); - - g_bCallBackHit = true; - service_app_exit(); - return; -} - -/** -* @function TimeComplicationUpdatedCb -* @description Callback Function -* @parameters int nComplicationId,const char *pszProviderId,watchface_complication_type_e eType,const bundle *pszData, void *pszUserData -* @return NA -*/ -static void TimeComplicationUpdatedCb(int nComplicationId,const char *pszProviderId,watchface_complication_type_e eType,const bundle *pszData, void *pszUserData) -{ - long nTimeStamp = -1; - FPRINTF("[Line : %d][%s] %s invoked\\n", __LINE__, API_NAMESPACE, "TimeComplicationUpdatedCb"); - int nRet = watchface_complication_data_get_timestamp(pszData, &nTimeStamp); - CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_data_get_timestamp", WatchfaceComplicationGetError(nRet)); - if( nTimeStamp < 0 ) - { - FPRINTF("[Line : %d][%s] %s failed. nTimeStamp = %d\\n", __LINE__, API_NAMESPACE, "watchface_complication_data_get_timestamp", nTimeStamp); - service_app_exit(); - return; - } - - g_bCallBackHit = true; - service_app_exit(); - return; -} - -/** -* @function ImageComplicationUpdatedCb -* @description Callback Function -* @parameters int nComplicationId,const char *pszProviderId,watchface_complication_type_e eType,const bundle *pszData, void *pszUserData -* @return NA -*/ -static void ImageComplicationUpdatedCb(int nComplicationId,const char *pszProviderId,watchface_complication_type_e eType,const bundle *pszData, void *pszUserData) -{ - char *pszText; - int nRet; - - FPRINTF("[Line : %d][%s] %s invoked.\\n", __LINE__, API_NAMESPACE, "ImageComplicationUpdatedCb"); - nRet = watchface_complication_data_get_image_path(pszData, &pszText); - CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_data_get_image_path", WatchfaceComplicationGetError(nRet)); - CALLBACK_CHECK_HANDLE_EXIT(pszText, "watchface_complication_data_get_image_path"); - FREE_MEMORY(pszText); - - g_bCallBackHit = true; - service_app_exit(); - return; -} - -/** -* @function RangedValueComplicationUpdatedCb -* @description Callback Function -* @parameters int nComplicationId,const char *pszProviderId,watchface_complication_type_e eType,const bundle *pszData, void *pszUserData -* @return NA -*/ -static void RangedValueComplicationUpdatedCb(int nComplicationId,const char *pszProviderId,watchface_complication_type_e eType,const bundle *pszData, void *pszUserData) -{ - char *pszText; - int nRet; - double nCurrentValue = -1; - double nMinValue = -1; - double nMaxValue = -1; - - FPRINTF("[Line : %d][%s] %s invoked.\\n", __LINE__, API_NAMESPACE, "RangedValueComplicationUpdatedCb"); - nRet = watchface_complication_data_get_ranged_value(pszData, &nCurrentValue, &nMinValue, &nMaxValue); - CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_data_get_ranged_value", WatchfaceComplicationGetError(nRet)); - if( nCurrentValue < 0 ) - { - FPRINTF("[Line : %d][%s] %s failed. nCurrentValue = %d\\n", __LINE__, API_NAMESPACE, "watchface_complication_data_get_ranged_value", nCurrentValue); - service_app_exit(); - return; - } - if( nMinValue < 0 ) - { - FPRINTF("[Line : %d][%s] %s failed. nMinValue = %d\\n", __LINE__, API_NAMESPACE, "watchface_complication_data_get_ranged_value", nMinValue); - service_app_exit(); - return; - } - if( nMaxValue < 0 ) - { - FPRINTF("[Line : %d][%s] %s failed. nMaxValue = %d\\n", __LINE__, API_NAMESPACE, "watchface_complication_data_get_ranged_value", nMaxValue); - service_app_exit(); - return; - } - - g_bCallBackHit = true; - service_app_exit(); - return; -} - -/** -* @function IconComplicationUpdatedCb -* @description Callback Function -* @parameters int nComplicationId,const char *pszProviderId,watchface_complication_type_e eType,const bundle *pszData, void *pszUserData -* @return NA -*/ -static void IconComplicationUpdatedCb(int nComplicationId,const char *pszProviderId,watchface_complication_type_e eType,const bundle *pszData, void *pszUserData) -{ - char *pszText = NULL; - FPRINTF("[Line : %d][%s] %s invoked.\\n", __LINE__, API_NAMESPACE, "IconComplicationUpdatedCb"); - int nRet = watchface_complication_data_get_icon_path(pszData, &pszText); - CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_data_get_icon_path", WatchfaceComplicationGetError(nRet)); - CALLBACK_CHECK_HANDLE_EXIT(pszText, "watchface_complication_data_get_icon_path"); - FREE_MEMORY(pszText); - - g_bCallBackHit = true; - service_app_exit(); - return; -} - -/** -* @function ExtraDataComplicationUpdatedCb -* @description Callback Function -* @parameters int nComplicationId,const char *pszProviderId,watchface_complication_type_e eType,const bundle *pszData, void *pszUserData -* @return NA -*/ -static void ExtraDataComplicationUpdatedCb(int nComplicationId,const char *pszProviderId,watchface_complication_type_e eType,const bundle *pszData, void *pszUserData) -{ - char *pszExtraData = NULL; - - FPRINTF("[Line : %d][%s] %s invoked.\\n", __LINE__, API_NAMESPACE, "ExtraDataComplicationUpdatedCb"); - int nRet = watchface_complication_data_get_extra_data(pszData, &pszExtraData); - CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_data_get_extra_data", WatchfaceComplicationGetError(nRet)); - CALLBACK_CHECK_HANDLE_EXIT(pszExtraData, "watchface_complication_data_get_extra_data"); - FREE_MEMORY(pszExtraData); - - g_bCallBackHit = true; - return; -} - -static void ScreenReaderCb(int nComplicationId, const char *pszProviderId, watchface_complication_type_e eType, const bundle *pszData, void *pszUserData) -{ - char *pszText = NULL; - - FPRINTF("[Line : %d][%s] %s invoked.\\n", __LINE__, API_NAMESPACE, "ScreenReaderCb"); - int nRet = watchface_complication_data_get_screen_reader_text(pszData, &pszText); - CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_data_get_screen_reader_text", WatchfaceComplicationGetError(nRet)); - CALLBACK_CHECK_HANDLE_EXIT(pszText, "watchface_complication_data_get_screen_reader_text"); - FREE_MEMORY(pszText); - - g_bCallBackHit = true; - service_app_exit(); - return; -} - - -/*****************************************************Callback End*****************************************************/ -//& purpose: To get the id of provider in the complication -//& type: auto -/** -* @testcase ITc_watchface_complication_get_current_provider_id_p -* @since_tizen 5.0 -* @author SRID(samuel.peter) -* @reviewer SRID(manoj.g2) -* @type auto -* @description Gets the id of provider in the complication. -* @scenario Gets the id of provider in the complication. -* @apicovered watchface_complication_get_current_provider_id -* @passcase watchface_complication_get_current_provider_id returns 0 -* @failcase watchface_complication_get_current_provider_id returns 1 -* @precondition Complication handle should be created by watchface_complication_create(). -* @postcondition N/A -* */ -int ITc_watchface_complication_get_current_provider_id_p(void) -{ - START_TEST; - complication_h hHandle = NULL; - char *pszCurProvider = NULL; - int nRet = 0; - - nComplicatoinId++; - nRet = watchface_complication_create(nComplicatoinId, PROVIDER_ID, WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT, WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT, WATCHFACE_COMPLICATION_EVENT_NONE, &hHandle); - ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_create"); - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_create", WatchfaceComplicationGetError(nRet)); - CHECK_HANDLE_EXIT(hHandle, "watchface_complication_create"); - - nRet = watchface_complication_get_current_provider_id(hHandle, &pszCurProvider); - PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_get_current_provider_id", WatchfaceComplicationGetError(nRet), watchface_complication_destroy(hHandle)); - CHECK_HANDLE_EXIT_CLEANUP(pszCurProvider, "watchface_complication_get_current_provider_id", watchface_complication_destroy(hHandle)); - FREE_MEMORY(pszCurProvider); - - nRet = watchface_complication_destroy(hHandle); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_destroy", WatchfaceComplicationGetError(nRet)); - - service_app_exit(); - return 0; -} - -//& purpose: To get the currently set type of the complication -//& type: auto -/** -* @testcase ITc_watchface_complication_get_current_type_p -* @since_tizen 5.0 -* @author SRID(samuel.peter) -* @reviewer SRID(manoj.g2) -* @type auto -* @description Gets the currently set type of the complication. -* @scenario Gets the currently set type of the complication. -* @apicovered watchface_complication_get_current_type -* @passcase watchface_complication_get_current_type returns 0 -* @failcase watchface_complication_get_current_type returns 1 -* @precondition N/A -* @postcondition N/A -* */ -int ITc_watchface_complication_get_current_type_p(void) -{ - START_TEST; - complication_h hHandle = NULL; - int nRet = 0; - watchface_complication_type_e eCurType; - - nComplicatoinId++; - nRet = watchface_complication_create(nComplicatoinId, PROVIDER_ID, WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT, WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT, WATCHFACE_COMPLICATION_EVENT_NONE, &hHandle); - ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_create"); - PRINT_RESULT_EXIT(WATCHFACE_COMPLICATION_ERROR_NONE, nRet, "watchface_complication_create", WatchfaceComplicationGetError(nRet)); - CHECK_HANDLE_EXIT(hHandle, "watchface_complication_create"); - - nRet = watchface_complication_get_current_type(hHandle, &eCurType); - PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_get_current_type", WatchfaceComplicationGetError(nRet), watchface_complication_destroy(hHandle)); - if( eCurType < WATCHFACE_COMPLICATION_TYPE_NO_DATA || eCurType > WATCHFACE_COMPLICATION_TYPE_IMAGE ) - { - FPRINTF("[Line : %d][%s] %s failed. eCurType = %d\\n", __LINE__, API_NAMESPACE, "watchface_complication_get_current_type", eCurType); - watchface_complication_destroy(hHandle); - service_app_exit(); - return 1; - } - - nRet = watchface_complication_destroy(hHandle); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_destroy", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 0; -} - -//& purpose: To add and remove the callback function to use for complication update -//& type: auto -/** -* @testcase ITc_watchface_complication_add__update_remove_updated_cb_p -* @since_tizen 5.0 -* @author SRID(samuel.peter) -* @reviewer SRID(manoj.g2) -* @type auto -* @description Adds and removes the callback function to use for complication update. -* @scenario Adds and removes the callback function to use for complication update. -* @apicovered watchface_complication_add_updated_cb, watchface_complication_send_update_request, watchface_complication_remove_updated_cb -* @passcase Target APIs return 0 -* @failcase Target APIs return 1 -* @precondition Complication handle should be created by watchface_complication_create(). -* @postcondition N/A -* */ -int ITc_watchface_complication_add_update_remove_updated_cb_p(void) -{ - START_TEST; - complication_h hHandle = NULL; - nComplicatoinId++; - - int nRet = watchface_complication_create(nComplicatoinId, PROVIDER_ID, WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT, WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT, WATCHFACE_COMPLICATION_EVENT_NONE, &hHandle); - ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_create"); - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_create", WatchfaceComplicationGetError(nRet)); - CHECK_HANDLE_EXIT(hHandle, "watchface_complication_create"); - - nRet = watchface_complication_add_updated_cb(hHandle, WatchfaceComplicationUpdatedCb, WatchfaceComplicationErrorCb, NULL); - PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_add_updated_cb", WatchfaceComplicationGetError(nRet), watchface_complication_destroy(hHandle)); - - g_bCallBackHit = false; - - nRet = watchface_complication_send_update_request(hHandle); - PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_send_update_request", WatchfaceComplicationGetError(nRet), watchface_complication_remove_updated_cb(hHandle, WatchfaceComplicationUpdatedCb); watchface_complication_destroy(hHandle)); - - IterateGmainLoop(); - if(!g_bCallBackHit) - { - FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "WatchfaceComplicationUpdatedCb"); - nRet = watchface_complication_remove_updated_cb(hHandle, WatchfaceComplicationUpdatedCb); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_remove_updated_cb", WatchfaceComplicationGetError(nRet)); - nRet = watchface_complication_destroy(hHandle); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_destroy", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 1; - } - - nRet = watchface_complication_remove_updated_cb(hHandle, WatchfaceComplicationUpdatedCb); - PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_remove_updated_cb", WatchfaceComplicationGetError(nRet), watchface_complication_destroy(hHandle)); - - nRet = watchface_complication_destroy(hHandle); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_destroy", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - - return 0; -} - -//& purpose: To create and destroy a complication handle -//& type: auto -/** -* @testcase ITc_watchface_complication_create_destroy_p -* @since_tizen 5.0 -* @author SRID(samuel.peter) -* @reviewer SRID(manoj.g2) -* @type auto -* @description Creates and destroys a complication handle. -* @scenario Creates and destroys a complication handle. -* @apicovered watchface_complication_create, watchface_complication_destroy -* @passcase watchface_complication_create_destroy returns 0 -* @failcase watchface_complication_create_destroy returns 1 -* @precondition N/A -* @postcondition N/A -* */ -int ITc_watchface_complication_create_destroy_p(void) -{ - START_TEST; - complication_h hHandle = NULL; - int nRet = 0; - - nComplicatoinId++; - nRet = watchface_complication_create(nComplicatoinId, PROVIDER_ID, WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT, WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT, WATCHFACE_COMPLICATION_EVENT_NONE, &hHandle); - ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_create"); - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_create", WatchfaceComplicationGetError(nRet)); - CHECK_HANDLE_EXIT(hHandle, "watchface_complication_create"); - - nRet = watchface_complication_destroy(hHandle); - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_destroy", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 0; -} - -//& purpose: To get data type of complication data. -//& type: auto -/** -* @testcase ITc_watchface_complication_data_get_type_p -* @since_tizen 5.0 -* @author SRID(samuel.peter) -* @reviewer SRID(manoj.g2) -* @type auto -* @description Gets data type of complication data. -* @scenario Gets data type of complication data. -* @apicovered watchface_complication_data_get_type -* @passcase watchface_complication_data_get_type returns 0 -* @failcase watchface_complication_data_get_type returns 1 -* @precondition N/A -* @postcondition N/A -* */ - -int ITc_watchface_complication_data_get_type_p(void) -{ - START_TEST; - complication_h hHandle = NULL; - - nComplicatoinId++; - int nRet = watchface_complication_create(nComplicatoinId, PROVIDER_ID, WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT, WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT, WATCHFACE_COMPLICATION_EVENT_NONE, &hHandle); - ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_create"); - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_create", WatchfaceComplicationGetError(nRet)); - CHECK_HANDLE_EXIT(hHandle, "watchface_complication_create"); - - nRet = watchface_complication_add_updated_cb(hHandle, TypeComplicationUpdatedCb, WatchfaceComplicationErrorCb, NULL); - PRINT_RESULT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_add_updated_cb", WatchfaceComplicationGetError(nRet), watchface_complication_destroy(hHandle)); - - g_bCallBackHit = false; - nRet = watchface_complication_send_update_request(hHandle); - PRINT_RESULT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_send_update_request", WatchfaceComplicationGetError(nRet), watchface_complication_remove_updated_cb(hHandle, TypeComplicationUpdatedCb); watchface_complication_destroy(hHandle)); - IterateGmainLoop(); - if(!g_bCallBackHit) - { - FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "TypeComplicationUpdatedCb"); - nRet = watchface_complication_remove_updated_cb(hHandle, TypeComplicationUpdatedCb); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_remove_updated_cb", WatchfaceComplicationGetError(nRet)); - nRet = watchface_complication_destroy(hHandle); - return 1; - } - - nRet = watchface_complication_remove_updated_cb(hHandle, TypeComplicationUpdatedCb); - PRINT_RESULT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_remove_updated_cb", WatchfaceComplicationGetError(nRet), watchface_complication_destroy(hHandle)); - - nRet = watchface_complication_destroy(hHandle); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_destroy", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 0; -} - -//& purpose: To get short text from complication data -//& type: auto -/** -* @testcase ITc_watchface_complication_data_get_short_text_p -* @since_tizen 5.0 -* @author SRID(samuel.peter) -* @reviewer SRID(manoj.g2) -* @type auto -* @description Gets short text from complication data. -* @scenario Gets short text from complication data. -* @apicovered watchface_complication_data_get_short_text -* @passcase watchface_complication_data_get_short_text returns 0 -* @failcase watchface_complication_data_get_short_text returns 1 -* @precondition N/A -* @postcondition N/A -* */ -int ITc_watchface_complication_data_get_short_text_p(void) -{ - START_TEST; - complication_h hHandle = NULL; - g_bCallBackHit = false; - - nComplicatoinId++; - int nRet = watchface_complication_create(nComplicatoinId, PROVIDER_ID, WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT, WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT, WATCHFACE_COMPLICATION_EVENT_NONE, &hHandle); - ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_create"); - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_create", WatchfaceComplicationGetError(nRet)); - CHECK_HANDLE_EXIT(hHandle, "watchface_complication_create"); - - nRet = watchface_complication_add_updated_cb(hHandle, ShortTextComplicationUpdatedCb, WatchfaceComplicationErrorCb, NULL); - PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_add_updated_cb", WatchfaceComplicationGetError(nRet), watchface_complication_destroy(hHandle)); - - nRet = watchface_complication_send_update_request(hHandle); - PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_send_update_request", WatchfaceComplicationGetError(nRet), watchface_complication_remove_updated_cb(hHandle, ShortTextComplicationUpdatedCb); watchface_complication_destroy(hHandle)); - - IterateGmainLoop(); - if(!g_bCallBackHit) - { - FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "ShortTextComplicationUpdatedCb"); - nRet = watchface_complication_remove_updated_cb(hHandle, ShortTextComplicationUpdatedCb); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_remove_updated_cb", WatchfaceComplicationGetError(nRet)); - nRet = watchface_complication_destroy(hHandle); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_destroy", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 1; - } - - nRet = watchface_complication_remove_updated_cb(hHandle, ShortTextComplicationUpdatedCb); - PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_remove_updated_cb", WatchfaceComplicationGetError(nRet), watchface_complication_destroy(hHandle)); - - nRet = watchface_complication_destroy(hHandle); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_destroy", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 0; -} - -//& purpose: To get long text from complication data -//& type: auto -/** -* @testcase ITc_watchface_complication_data_get_long_text_p -* @since_tizen 5.0 -* @author SRID(samuel.peter) -* @reviewer SRID(manoj.g2) -* @type auto -* @description Gets long text from complication data. -* @scenario Gets long text from complication data. -* @apicovered watchface_complication_data_get_long_text -* @passcase watchface_complication_data_get_long_text returns 0 -* @failcase watchface_complication_data_get_long_text returns 1 -* @precondition N/A -* @postcondition N/A -* */ -int ITc_watchface_complication_data_get_long_text_p(void) -{ - START_TEST; - complication_h hHandle = NULL; - - nComplicatoinId++; - int nRet = watchface_complication_create(nComplicatoinId, PROVIDER_ID, WATCHFACE_COMPLICATION_TYPE_LONG_TEXT, WATCHFACE_COMPLICATION_TYPE_LONG_TEXT, WATCHFACE_COMPLICATION_EVENT_NONE, &hHandle); - ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_create"); - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_create", WatchfaceComplicationGetError(nRet)); - CHECK_HANDLE_EXIT(hHandle, "watchface_complication_create"); - - nRet = watchface_complication_add_updated_cb(hHandle, LongTextComplicationUpdatedCb, WatchfaceComplicationErrorCb, NULL); - PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_add_updated_cb", WatchfaceComplicationGetError(nRet), watchface_complication_destroy(hHandle)); - - g_bCallBackHit = false; - nRet = watchface_complication_send_update_request(hHandle); - PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_send_update_request", WatchfaceComplicationGetError(nRet), watchface_complication_remove_updated_cb(hHandle, LongTextComplicationUpdatedCb); watchface_complication_destroy(hHandle)); - - IterateGmainLoop(); - if(!g_bCallBackHit) - { - FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "LongTextComplicationUpdatedCb"); - nRet = watchface_complication_remove_updated_cb(hHandle, LongTextComplicationUpdatedCb); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_remove_updated_cb", WatchfaceComplicationGetError(nRet)); - nRet = watchface_complication_destroy(hHandle); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_destroy", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 1; - } - - nRet = watchface_complication_remove_updated_cb(hHandle, LongTextComplicationUpdatedCb); - PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_remove_updated_cb", WatchfaceComplicationGetError(nRet), watchface_complication_destroy(hHandle)); - - nRet = watchface_complication_destroy(hHandle); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_destroy", WatchfaceComplicationGetError(nRet)); - - service_app_exit(); - return 0; -} - -//& purpose: To get title text from complication data -//& type: auto -/** -* @testcase ITc_watchface_complication_data_get_title_p -* @since_tizen 5.0 -* @author SRID(samuel.peter) -* @reviewer SRID(manoj.g2) -* @type auto -* @description Gets title text from complication data. -* @scenario Gets title text from complication data. -* @apicovered watchface_complication_data_get_title -* @passcase watchface_complication_data_get_title returns 0 -* @failcase watchface_complication_data_get_title returns 1 -* @precondition N/A -* @postcondition N/A -* */ -int ITc_watchface_complication_data_get_title_p(void) -{ - START_TEST; - complication_h hHandle = NULL; - nComplicatoinId++; - - int nRet = watchface_complication_create(nComplicatoinId, PROVIDER_ID, WATCHFACE_COMPLICATION_TYPE_LONG_TEXT, WATCHFACE_COMPLICATION_TYPE_LONG_TEXT, WATCHFACE_COMPLICATION_EVENT_NONE, &hHandle); - ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_create"); - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_create", WatchfaceComplicationGetError(nRet)); - CHECK_HANDLE_EXIT(hHandle, "watchface_complication_create"); - - nRet = watchface_complication_add_updated_cb(hHandle, TitleComplicationUpdatedCb, WatchfaceComplicationErrorCb, NULL); - PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_add_updated_cb", WatchfaceComplicationGetError(nRet), watchface_complication_destroy(hHandle)); - - g_bCallBackHit = false; - - nRet = watchface_complication_send_update_request(hHandle); - PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_send_update_request", WatchfaceComplicationGetError(nRet), watchface_complication_remove_updated_cb(hHandle, TitleComplicationUpdatedCb); watchface_complication_destroy(hHandle)); - - IterateGmainLoop(); - if(!g_bCallBackHit) - { - FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "TitleComplicationUpdatedCb"); - nRet = watchface_complication_remove_updated_cb(hHandle, TitleComplicationUpdatedCb); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_remove_updated_cb", WatchfaceComplicationGetError(nRet)); - nRet = watchface_complication_destroy(hHandle); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_destroy", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 1; - } - - nRet = watchface_complication_remove_updated_cb(hHandle, TitleComplicationUpdatedCb); - PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_remove_updated_cb", WatchfaceComplicationGetError(nRet), watchface_complication_destroy(hHandle)); - - nRet = watchface_complication_destroy(hHandle); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_destroy", WatchfaceComplicationGetError(nRet)); - - service_app_exit(); - return 0; -} - -//& purpose: To get timestamp from complication data -//& type: auto -/** -* @testcase ITc_watchface_complication_data_get_timestamp_p -* @since_tizen 5.0 -* @author SRID(samuel.peter) -* @reviewer SRID(manoj.g2) -* @type auto -* @description Gets timestamp from complication data. -* @scenario Gets timestamp from complication data. -* @apicovered watchface_complication_data_get_timestamp -* @passcase watchface_complication_data_get_timestamp returns 0 -* @failcase watchface_complication_data_get_timestamp returns 1 -* @precondition N/A -* @postcondition N/A -* */ -int ITc_watchface_complication_data_get_timestamp_p(void) -{ - START_TEST; - complication_h hHandle = NULL; - g_bCallBackHit = false; - nComplicatoinId++; - - int nRet = watchface_complication_create(nComplicatoinId, PROVIDER_ID, WATCHFACE_COMPLICATION_TYPE_TIME, WATCHFACE_COMPLICATION_TYPE_TIME, WATCHFACE_COMPLICATION_EVENT_NONE, &hHandle); - ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_create"); - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_create", WatchfaceComplicationGetError(nRet)); - CHECK_HANDLE_EXIT(hHandle, "watchface_complication_create"); - nRet = watchface_complication_add_updated_cb(hHandle, TimeComplicationUpdatedCb, WatchfaceComplicationErrorCb, NULL); - PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_add_updated_cb", WatchfaceComplicationGetError(nRet), watchface_complication_destroy(hHandle)); - - nRet = watchface_complication_send_update_request(hHandle); - PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_send_update_request", WatchfaceComplicationGetError(nRet), watchface_complication_remove_updated_cb(hHandle, TimeComplicationUpdatedCb); watchface_complication_destroy(hHandle)); - - IterateGmainLoop(); - if(!g_bCallBackHit) - { - FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "TimeComplicationUpdatedCb"); - nRet = watchface_complication_remove_updated_cb(hHandle, TimeComplicationUpdatedCb); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_remove_updated_cb", WatchfaceComplicationGetError(nRet)); - nRet = watchface_complication_destroy(hHandle); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_destroy", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 1; - } - - nRet = watchface_complication_remove_updated_cb(hHandle, TimeComplicationUpdatedCb); - PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_remove_updated_cb", WatchfaceComplicationGetError(nRet), watchface_complication_destroy(hHandle)); - - nRet = watchface_complication_destroy(hHandle); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_destroy", WatchfaceComplicationGetError(nRet)); - - service_app_exit(); - return 0; -} - -//& purpose: To get image path from complication data -//& type: auto -/** -* @testcase ITc_watchface_complication_data_get_image_path_p -* @since_tizen 5.0 -* @author SRID(samuel.peter) -* @reviewer SRID(manoj.g2) -* @type auto -* @description Gets image path from complication data. -* @scenario Gets image path from complication data. -* @apicovered watchface_complication_data_get_image_path -* @passcase watchface_complication_data_get_image_path returns 0 -* @failcase watchface_complication_data_get_image_path returns 1 -* @precondition N/A -* @postcondition N/A -* */ -int ITc_watchface_complication_data_get_image_path_p(void) -{ - START_TEST; - complication_h hHandle = NULL; - g_bCallBackHit = false; - - nComplicatoinId++; - int nRet = watchface_complication_create(nComplicatoinId, PROVIDER_ID, WATCHFACE_COMPLICATION_TYPE_IMAGE, WATCHFACE_COMPLICATION_TYPE_IMAGE, WATCHFACE_COMPLICATION_EVENT_NONE, &hHandle); - ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_create"); - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_create", WatchfaceComplicationGetError(nRet)); - CHECK_HANDLE_EXIT(hHandle, "watchface_complication_create"); - - nRet = watchface_complication_add_updated_cb(hHandle, ImageComplicationUpdatedCb, WatchfaceComplicationErrorCb, NULL); - PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_add_updated_cb", WatchfaceComplicationGetError(nRet), watchface_complication_destroy(hHandle)); - - - nRet = watchface_complication_send_update_request(hHandle); - PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_send_update_request", WatchfaceComplicationGetError(nRet), watchface_complication_remove_updated_cb(hHandle, ImageComplicationUpdatedCb); watchface_complication_destroy(hHandle)); - - IterateGmainLoop(); - if(!g_bCallBackHit) - { - FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "ImageComplicationUpdatedCb"); - nRet = watchface_complication_remove_updated_cb(hHandle, ImageComplicationUpdatedCb); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_remove_updated_cb", WatchfaceComplicationGetError(nRet)); - nRet = watchface_complication_destroy(hHandle); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_destroy", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 1; - } - - nRet = watchface_complication_remove_updated_cb(hHandle, ImageComplicationUpdatedCb); - PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_remove_updated_cb", WatchfaceComplicationGetError(nRet), watchface_complication_destroy(hHandle)); - - nRet = watchface_complication_destroy(hHandle); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_destroy", WatchfaceComplicationGetError(nRet)); - - service_app_exit(); - return 0; -} - -//& purpose: To get ranged value from complication data -//& type: auto -/** -* @testcase ITc_watchface_complication_data_get_ranged_value_p -* @since_tizen 5.0 -* @author SRID(samuel.peter) -* @reviewer SRID(manoj.g2) -* @type auto -* @description Gets ranged value from complication data. -* @scenario Gets ranged value from complication data. -* @apicovered watchface_complication_data_get_ranged_value -* @passcase watchface_complication_data_get_ranged_value returns 0 -* @failcase watchface_complication_data_get_ranged_value returns 1 -* @precondition N/A -* @postcondition N/A -* */ -int ITc_watchface_complication_data_get_ranged_value_p(void) -{ - START_TEST; - complication_h hHandle = NULL; - g_bCallBackHit = false; - - nComplicatoinId++; - int nRet = watchface_complication_create(nComplicatoinId, PROVIDER_ID, WATCHFACE_COMPLICATION_TYPE_RANGED_VALUE, WATCHFACE_COMPLICATION_TYPE_RANGED_VALUE, WATCHFACE_COMPLICATION_EVENT_NONE, &hHandle); - ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_create"); - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_create", WatchfaceComplicationGetError(nRet)); - CHECK_HANDLE_EXIT(hHandle, "watchface_complication_create"); - - nRet = watchface_complication_add_updated_cb(hHandle, RangedValueComplicationUpdatedCb, WatchfaceComplicationErrorCb, NULL); - PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_add_updated_cb", WatchfaceComplicationGetError(nRet), watchface_complication_destroy(hHandle)); - - nRet = watchface_complication_send_update_request(hHandle); - PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_send_update_request", WatchfaceComplicationGetError(nRet), watchface_complication_remove_updated_cb(hHandle, RangedValueComplicationUpdatedCb); watchface_complication_destroy(hHandle)); - - IterateGmainLoop(); - if(!g_bCallBackHit) - { - FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "RangedValueComplicationUpdatedCb"); - nRet = watchface_complication_remove_updated_cb(hHandle, RangedValueComplicationUpdatedCb); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_remove_updated_cb", WatchfaceComplicationGetError(nRet)); - nRet = watchface_complication_destroy(hHandle); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_destroy", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 1; - } - - nRet = watchface_complication_remove_updated_cb(hHandle, RangedValueComplicationUpdatedCb); - PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_remove_updated_cb", WatchfaceComplicationGetError(nRet), watchface_complication_destroy(hHandle)); - - nRet = watchface_complication_destroy(hHandle); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_destroy", WatchfaceComplicationGetError(nRet)); - - service_app_exit(); - return 0; -} - -//& purpose: To get icon path from complication data -//& type: auto -/** -* @testcase ITc_watchface_complication_data_get_icon_path_p -* @since_tizen 5.0 -* @author SRID(samuel.peter) -* @reviewer SRID(manoj.g2) -* @type auto -* @description Gets icon path from complication data. -* @scenario Gets icon path from complication data. -* @apicovered watchface_complication_data_get_icon_path -* @passcase watchface_complication_data_get_icon_path returns 0 -* @failcase watchface_complication_data_get_icon_path returns 1 -* @precondition N/A -* @postcondition N/A -* */ -int ITc_watchface_complication_data_get_icon_path_p(void) -{ - START_TEST; - complication_h hHandle = NULL; - g_bCallBackHit = false; - - nComplicatoinId++; - int nRet = watchface_complication_create(nComplicatoinId, PROVIDER_ID, WATCHFACE_COMPLICATION_TYPE_ICON, WATCHFACE_COMPLICATION_TYPE_ICON, WATCHFACE_COMPLICATION_EVENT_NONE, &hHandle); - ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_create"); - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_create", WatchfaceComplicationGetError(nRet)); - CHECK_HANDLE_EXIT(hHandle, "watchface_complication_create"); - - nRet = watchface_complication_add_updated_cb(hHandle, IconComplicationUpdatedCb, WatchfaceComplicationErrorCb, NULL); - PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_add_updated_cb", WatchfaceComplicationGetError(nRet), watchface_complication_destroy(hHandle)); - - nRet = watchface_complication_send_update_request(hHandle); - PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_send_update_request", WatchfaceComplicationGetError(nRet), watchface_complication_remove_updated_cb(hHandle, IconComplicationUpdatedCb); watchface_complication_destroy(hHandle)); - - IterateGmainLoop(); - if(!g_bCallBackHit) - { - FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "IconComplicationUpdatedCb"); - nRet = watchface_complication_remove_updated_cb(hHandle, IconComplicationUpdatedCb); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_remove_updated_cb", WatchfaceComplicationGetError(nRet)); - nRet = watchface_complication_destroy(hHandle); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_destroy", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 1; - } - - nRet = watchface_complication_remove_updated_cb(hHandle, IconComplicationUpdatedCb); - PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_remove_updated_cb", WatchfaceComplicationGetError(nRet), watchface_complication_destroy(hHandle)); - - nRet = watchface_complication_destroy(hHandle); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_destroy", WatchfaceComplicationGetError(nRet)); - - service_app_exit(); - return 0; -} - -//& purpose: To get extra data from complication data -//& type: auto -/** -* @testcase ITc_watchface_complication_data_get_extra_data_p -* @since_tizen 5.0 -* @author SRID(samuel.peter) -* @reviewer SRID(manoj.g2) -* @type auto -* @description Gets extra data from complication data. -* @scenario Gets extra data from complication data. -* @apicovered watchface_complication_data_get_extra_data -* @passcase watchface_complication_data_get_extra_data returns 0 -* @failcase watchface_complication_data_get_extra_data returns 1 -* @precondition N/A -* @postcondition N/A -* */ -int ITc_watchface_complication_data_get_extra_data_p(void) -{ - START_TEST; - complication_h hHandle = NULL; - g_bCallBackHit = false; - nComplicatoinId++; - - int nRet = watchface_complication_create(nComplicatoinId, PROVIDER_ID, WATCHFACE_COMPLICATION_TYPE_ICON, WATCHFACE_COMPLICATION_TYPE_ICON, WATCHFACE_COMPLICATION_EVENT_NONE, &hHandle); - ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_create"); - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_create", WatchfaceComplicationGetError(nRet)); - CHECK_HANDLE_EXIT(hHandle, "watchface_complication_create"); - - nRet = watchface_complication_add_updated_cb(hHandle, ExtraDataComplicationUpdatedCb, WatchfaceComplicationErrorCb, NULL); - PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_add_updated_cb", WatchfaceComplicationGetError(nRet), watchface_complication_destroy(hHandle)); - - nRet = watchface_complication_send_update_request(hHandle); - PRINT_RESULT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_send_update_request", WatchfaceComplicationGetError(nRet), watchface_complication_remove_updated_cb(hHandle, ExtraDataComplicationUpdatedCb); watchface_complication_destroy(hHandle)); - - IterateGmainLoop(); - if(!g_bCallBackHit) - { - FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "ExtraDataComplicationUpdatedCb"); - nRet = watchface_complication_remove_updated_cb(hHandle, ExtraDataComplicationUpdatedCb); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_remove_updated_cb", WatchfaceComplicationGetError(nRet)); - nRet = watchface_complication_destroy(hHandle); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_destroy", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 1; - } - - nRet = watchface_complication_remove_updated_cb(hHandle, ExtraDataComplicationUpdatedCb); - PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_remove_updated_cb", WatchfaceComplicationGetError(nRet), watchface_complication_destroy(hHandle)); - - nRet = watchface_complication_destroy(hHandle); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_destroy", WatchfaceComplicationGetError(nRet)); - - service_app_exit(); - return 0; -} - -//& purpose: To create and destroy allowed list -//& type: auto -/** -* @testcase ITc_watchface_complication_allowed_list_create_destroy_p -* @since_tizen 5.0 -* @author SRID(samuel.peter) -* @reviewer SRID(manoj.g2) -* @type auto -* @description Creates and destroys allowed list. -* @scenario Creates and destroys allowed list. -* @apicovered watchface_complication_allowed_list_create, watchface_complication_allowed_list_destroy -* @passcase watchface_complication_allowed_list_create, watchface_complication_allowed_list_destroy return 0 -* @failcase watchface_complication_allowed_list_create, watchface_complication_allowed_list_destroy return 1 -* @precondition N/A -* @postcondition N/A -* */ - -int ITc_watchface_complication_allowed_list_create_destroy_p(void) -{ - START_TEST; - complication_allowed_list_h hHandle = NULL; - int nRet = 0; - - nRet = watchface_complication_allowed_list_create(&hHandle); - ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_allowed_list_create"); - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_allowed_list_create", WatchfaceComplicationGetError(nRet)); - CHECK_HANDLE(hHandle, "watchface_complication_allowed_list_create"); - - nRet = watchface_complication_allowed_list_destroy(hHandle); - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_allowed_list_destroy", WatchfaceComplicationGetError(nRet)); - - service_app_exit(); - return 0; -} - -//& purpose: To add and delete provider info from the allowed list -//& type: auto -/** -* @testcase ITc_watchface_complication_allowed_list_add_delete_p -* @since_tizen 5.0 -* @author SRID(samuel.peter) -* @reviewer SRID(manoj.g2) -* @type auto -* @description Adds and deletes provider info from the allowed list. -* @scenario Adds and deletes provider info from the allowed list. -* @apicovered watchface_complication_allowed_list_add, watchface_complication_allowed_list_delete -* @passcase watchface_complication_allowed_list_add, watchface_complication_allowed_list_delete returns 0 -* @failcase watchface_complication_allowed_list_add, watchface_complication_allowed_list_delete returns 1 -* @precondition N/A -* @postcondition N/A -* */ -int ITc_watchface_complication_allowed_list_add_delete_p(void) -{ - START_TEST; - complication_allowed_list_h hHandle = NULL; - int nRet = 0; - - nRet = watchface_complication_allowed_list_create(&hHandle); - ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_allowed_list_create"); - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_allowed_list_create", WatchfaceComplicationGetError(nRet)); - CHECK_HANDLE_EXIT(hHandle, "watchface_complication_allowed_list_create"); - - nRet = watchface_complication_allowed_list_add(hHandle, PROVIDER_ID, WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT); - PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_allowed_list_add", WatchfaceComplicationGetError(nRet), watchface_complication_allowed_list_destroy(hHandle)); - - nRet = watchface_complication_allowed_list_delete(hHandle, PROVIDER_ID); - PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_allowed_list_delete", WatchfaceComplicationGetError(nRet), watchface_complication_allowed_list_destroy(hHandle)); - - nRet = watchface_complication_allowed_list_destroy(hHandle); - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_allowed_list_destroy", WatchfaceComplicationGetError(nRet)); - - service_app_exit(); - return 0; -} - -//& purpose: To get n-th item of the allowed list -//& type: auto -/** -* @testcase ITc_watchface_complication_allowed_list_get_nth_p -* @since_tizen 5.0 -* @author SRID(samuel.peter) -* @reviewer SRID(manoj.g2) -* @type auto -* @description Gets n-th item of the allowed list. -* @scenario Gets n-th item of the allowed list. -* @apicovered watchface_complication_allowed_list_get_nth -* @passcase watchface_complication_allowed_list_get_nth returns 0 -* @failcase watchface_complication_allowed_list_get_nth returns 1 -* @precondition N/A -* @postcondition N/A -* */ -int ITc_watchface_complication_allowed_list_get_nth_p(void) -{ - START_TEST; - complication_allowed_list_h hHandle = NULL; - char *pszProviderId = NULL; - int nIndex = 0; - int nTypes = -1; - int nRet = 0; - - nRet = watchface_complication_allowed_list_create(&hHandle); - ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_allowed_list_create"); - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_allowed_list_create", WatchfaceComplicationGetError(nRet)); - CHECK_HANDLE_EXIT(hHandle, "watchface_complication_allowed_list_create"); - - nRet = watchface_complication_allowed_list_add(hHandle, PROVIDER_ID, WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT); - PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_allowed_list_add", WatchfaceComplicationGetError(nRet), watchface_complication_allowed_list_destroy(hHandle)); - - nRet = watchface_complication_allowed_list_get_nth(hHandle, nIndex, &pszProviderId, &nTypes); - PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_allowed_list_get_nth", WatchfaceComplicationGetError(nRet), watchface_complication_allowed_list_destroy(hHandle)); - CHECK_HANDLE_EXIT_CLEANUP(pszProviderId, "watchface_complication_allowed_list_get_nth", watchface_complication_allowed_list_destroy(hHandle)); - - if(strncmp(pszProviderId, PROVIDER_ID, strlen(pszProviderId)) != 0) - { - FPRINTF("[Line : %d][%s] %s failed. pszProviderId = %s\\n", __LINE__, API_NAMESPACE, "watchface_complication_allowed_list_get_nth", pszProviderId); - FREE_MEMORY(pszProviderId); - watchface_complication_allowed_list_destroy(hHandle); - return 1; - } - FREE_MEMORY(pszProviderId); - - if( nTypes < 0 ) - { - FPRINTF("[Line : %d][%s] %s failed. nTypes = %d\\n", __LINE__, API_NAMESPACE, "watchface_complication_allowed_list_get_nth", nTypes); - watchface_complication_allowed_list_destroy(hHandle); - return 1; - } - - nRet = watchface_complication_allowed_list_destroy(hHandle); - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_allowed_list_destroy", WatchfaceComplicationGetError(nRet)); - - service_app_exit(); - return 0; -} - -//& purpose: To apply and clear the allowed list to a complication -//& type: auto -/** -* @testcase ITc_watchface_complication_allowed_list_apply_clear_p -* @since_tizen 5.0 -* @author SRID(samuel.peter) -* @reviewer SRID(manoj.g2) -* @type auto -* @description Applies and clears the allowed list to a complication. -* @scenario Applies and clears the allowed list to a complication. -* @apicovered watchface_complication_allowed_list_apply, watchface_complication_allowed_list_clear -* @passcase watchface_complication_allowed_list_apply, watchface_complication_allowed_list_clear return 0 -* @failcase watchface_complication_allowed_list_apply, watchface_complication_allowed_list_clear return 1 -* @precondition N/A -* @postcondition N/A -* */ -int ITc_watchface_complication_allowed_list_apply_clear_p(void) -{ - START_TEST; - complication_h hHandle = NULL; - complication_allowed_list_h hListHandle = NULL; - - nComplicatoinId++; - int nRet = watchface_complication_create(nComplicatoinId, PROVIDER_ID, WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT, WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT, WATCHFACE_COMPLICATION_EVENT_NONE, &hHandle); - ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_create"); - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_create", WatchfaceComplicationGetError(nRet)); - CHECK_HANDLE_EXIT(hHandle, "watchface_complication_create"); - - nRet = watchface_complication_allowed_list_create(&hListHandle); - PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_allowed_list_create", WatchfaceComplicationGetError(nRet), watchface_complication_destroy(hHandle)); - CHECK_HANDLE_EXIT_CLEANUP(hListHandle, "watchface_complication_allowed_list_create", watchface_complication_destroy(hHandle)); - - nRet = watchface_complication_allowed_list_add(hListHandle, PROVIDER_ID, WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT); - PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_allowed_list_add", WatchfaceComplicationGetError(nRet), watchface_complication_allowed_list_destroy(hListHandle); watchface_complication_destroy(hHandle)); - - nRet = watchface_complication_allowed_list_apply(hHandle, hListHandle); - PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_allowed_list_apply", WatchfaceComplicationGetError(nRet), watchface_complication_allowed_list_destroy(hListHandle); watchface_complication_destroy(hHandle)); - - nRet = watchface_complication_allowed_list_clear(hHandle); - PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_allowed_list_clear", WatchfaceComplicationGetError(nRet), watchface_complication_allowed_list_destroy(hListHandle); watchface_complication_destroy(hHandle)); - - nRet = watchface_complication_allowed_list_destroy(hListHandle); - PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_allowed_list_destroy", WatchfaceComplicationGetError(nRet), watchface_complication_destroy(hHandle)); - - nRet = watchface_complication_destroy(hHandle); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_destroy", WatchfaceComplicationGetError(nRet)); - - service_app_exit(); - return 0; -} - -//& purpose: To get screen reader text from complication data -//& type: auto -/** -* @testcase ITc_watchface_complication_data_get_screen_reader_text_p -* @since_tizen 5.0 -* @author SRID(samuel.peter) -* @reviewer SRID(manoj.g2) -* @type auto -* @description Gets screen reader text from complication data. -* @scenario Gets screen reader text from complication data. -* @apicovered watchface_complication_data_get_screen_reader_text -* @passcase watchface_complication_data_get_screen_reader_text return 0 -* @failcase watchface_complication_data_get_screen_reader_text return 1 -* @precondition N/A -* @postcondition N/A -* */ -int ITc_watchface_complication_data_get_screen_reader_text_p(void) -{ - START_TEST; - complication_h hHandle = NULL; - nComplicatoinId++; - g_bCallBackHit = false; - - int nRet = watchface_complication_create(nComplicatoinId, PROVIDER_ID, WATCHFACE_COMPLICATION_TYPE_ICON, WATCHFACE_COMPLICATION_TYPE_ICON, - WATCHFACE_COMPLICATION_EVENT_NONE, &hHandle); - ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_create"); - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_create", WatchfaceComplicationGetError(nRet)); - CHECK_HANDLE_EXIT(hHandle, "watchface_complication_create"); - - nRet = watchface_complication_add_updated_cb(hHandle, ScreenReaderCb, WatchfaceComplicationErrorCb, NULL); - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_add_updated_cb", WatchfaceComplicationGetError(nRet)); - - nRet = watchface_complication_send_update_request(hHandle); - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_send_update_request", WatchfaceComplicationGetError(nRet)); - - IterateGmainLoop(); - if(!g_bCallBackHit) - { - FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "ScreenReaderCb"); - nRet = watchface_complication_remove_updated_cb(hHandle, RangedValueComplicationUpdatedCb); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_remove_updated_cb", WatchfaceComplicationGetError(nRet)); - nRet = watchface_complication_destroy(hHandle); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_destroy", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 1; - } - - nRet = watchface_complication_remove_updated_cb(hHandle, ScreenReaderCb); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_remove_updated_cb", WatchfaceComplicationGetError(nRet)); - - nRet = watchface_complication_destroy(hHandle); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_destroy", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - - return 0; -} - -//& purpose: To transfer touch event to the complication provider -//& type: auto -/** -* @testcase ITc_watchface_complication_transfer_event_p -* @since_tizen 5.0 -* @author SRID(samuel.peter) -* @reviewer SRID(manoj.g2) -* @type auto -* @description Transfers touch event to the complication provider. -* @scenario Transfers touch event to the complication provider. -* @apicovered watchface_complication_transfer_event -* @passcase watchface_complication_transfer_event return 0 -* @failcase watchface_complication_transfer_event return 1 -* @precondition N/A -* @postcondition N/A -* */ -int ITc_watchface_complication_transfer_event_p(void) -{ - START_TEST; - complication_h hHandle; - nComplicatoinId++; - - int nRet = watchface_complication_create(nComplicatoinId, PROVIDER_ID, WATCHFACE_COMPLICATION_TYPE_ICON, WATCHFACE_COMPLICATION_TYPE_ICON, - WATCHFACE_COMPLICATION_EVENT_NONE, &hHandle); - ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_complication_create"); - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_create", WatchfaceComplicationGetError(nRet)); - - nRet = watchface_complication_add_updated_cb(hHandle, ScreenReaderCb, WatchfaceComplicationErrorCb, NULL); - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_add_updated_cb", WatchfaceComplicationGetError(nRet)); - - nRet = watchface_complication_transfer_event(hHandle, WATCHFACE_COMPLICATION_EVENT_TAP); - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_transfer_event", WatchfaceComplicationGetError(nRet)); - - nRet = watchface_complication_remove_updated_cb(hHandle, ScreenReaderCb); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_remove_updated_cb", WatchfaceComplicationGetError(nRet)); - - nRet = watchface_complication_destroy(hHandle); - PRINT_RESULT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_destroy", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 0; -} - diff --git a/src/itc/watchface/ITs-watchface-editable.c b/src/itc/watchface/ITs-watchface-editable.c deleted file mode 100755 index 821efd928..000000000 --- a/src/itc/watchface/ITs-watchface-editable.c +++ /dev/null @@ -1,1363 +0,0 @@ -// -// Copyright (c) 2018 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 "ITs-watchface-common.h" -#include -#define PROVIDER_ID "org.tizen.watchface_sample_provider/test" -#define EDITOR_ID "org.tizen.watchface_sample_editor" -#define MAX_COUNTER 5 -#define GEO_X 100 -#define GEO_Y 100 -#define GEO_W 100 -#define GEO_H 100 - -/** @addtogroup itc-watchface -* @ingroup itc -* @{ -*/ - -//& set: watchface - -/** -* @function ITs_watchface_editable_startup -* @description Called before each test, set the service boolean true -* @parameter NA -* @nReturn NA -*/ -void ITs_watchface_editable_startup(void) -{ -#if DEBUG - FPRINTF("[Line : %d][%s] TEST SUIT start-up: ITs_Watchface_Editable_p\\n", __LINE__, API_NAMESPACE); -#endif - g_bWatchApp = TCTCheckSystemInfoFeatureSupported(FEATURE_WATCH_APP, API_NAMESPACE); - g_bFeatureNotSupported = false; - g_bIsFeatureMismatched = false; - return; -} - -/** -* @function ITs_watchface_editable_cleanup -* @description Called after each test -* @parameter NA -* @nReturn NA -*/ -void ITs_watchface_editable_cleanup(void) -{ -#if DEBUG - FPRINTF("[Line : %d][%s] TEST SUIT clean-up: ITs_Watchface_Editable_p\\n", __LINE__, API_NAMESPACE); -#endif - return; -} - - -/****************************************************Callback Start****************************************************/ -/** -* @function RunEditorApp -* @description Helper Function -* @parameters N/A -* @return N/A -*/ -static void RunEditorApp() -{ - FPRINTF("[Line : %d][%s] entered %s.\\n", __LINE__, API_NAMESPACE, "RunEditorApp"); - - static app_control_h hAppControl; - bool bIsRunning = false; - int nCounter = MAX_COUNTER; - int nRet; - - nRet = app_control_create(&hAppControl); - if(nRet != APP_CONTROL_ERROR_NONE) - { - FPRINTF("[Line : %d][%s] app_control_create returned %s error\\n", __LINE__, API_NAMESPACE, AppControlGetError(nRet)); - return; - } - if(hAppControl == NULL) - { - FPRINTF("[Line : %d][%s] %s failed, error returned = Handle returned is NULL\\n", __LINE__, API_NAMESPACE, "app_control_create"); - return; - } - - nRet = app_control_set_app_id(hAppControl, EDITOR_ID); - if(nRet != APP_CONTROL_ERROR_NONE) - { - FPRINTF("[Line : %d][%s] app_control_set_app_id returned %s error\\n", __LINE__, API_NAMESPACE, AppControlGetError(nRet)); - app_control_destroy(hAppControl); - return; - } - - nRet = app_control_add_extra_data(hAppControl, "SENDER_ID", "org.tizen.watchface-native-itc"); - if(nRet != APP_CONTROL_ERROR_NONE) - { - FPRINTF("[Line : %d][%s] app_control_add_extra_data returned %s error\\n", __LINE__, API_NAMESPACE, AppControlGetError(nRet)); - app_control_destroy(hAppControl); - return; - } - do { - nRet = app_control_send_launch_request(hAppControl, NULL, NULL); - if (nRet != APP_CONTROL_ERROR_NONE) - sleep(1); - app_manager_is_running(EDITOR_ID, &bIsRunning); - } while (--nCounter > 0 && !bIsRunning); - sleep(1); - - return; -} - - -/** -* @function RequestEditWithDesignElements -* @description Helper Function -* @parameters hEdCon, updateCb -* @return 0, 1 -*/ -static int RequestEditWithDesignElements(watchface_editable_container_h hEdCon, watchface_editable_update_requested_cb updateCb) -{ - FPRINTF("[Line : %d][%s] entered %s.\\n", __LINE__, API_NAMESPACE, "RequestEditWithDesignElements"); - int nRet; - complication_candidates_list_h hListHandle = NULL; - bundle *candidate1; - bundle *candidate2; - watchface_editable_highlight_h hHighlight = NULL; - - nRet = watchface_editable_candidates_list_create(&hListHandle); - ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_editable_candidates_list_create"); - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_candidates_list_create", WatchfaceComplicationGetError(nRet)); - CHECK_HANDLE_EXIT(hListHandle, "watchface_editable_candidates_list_create"); - - candidate1 = bundle_create(); - nRet = get_last_result(); - PRINT_RESULT_EXIT_CLEANUP(nRet, BUNDLE_ERROR_NONE, "bundle_create", BundleGetError(nRet), watchface_editable_candidates_list_destroy(hListHandle)); - CHECK_HANDLE_EXIT_CLEANUP(candidate1, "bundle_create", watchface_editable_candidates_list_destroy(hListHandle)); - bundle_add_str(candidate1, "COLOR", "RED"); - nRet = watchface_editable_candidates_list_add(hListHandle, candidate1); - PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_candidates_list_add", WatchfaceComplicationGetError(nRet), watchface_editable_candidates_list_destroy(hListHandle); bundle_free(candidate1)); - - candidate2 = bundle_create(); - nRet = get_last_result(); - PRINT_RESULT_EXIT_CLEANUP(nRet, BUNDLE_ERROR_NONE, "bundle_create", BundleGetError(nRet), watchface_editable_candidates_list_destroy(hListHandle);bundle_free(candidate1)); - CHECK_HANDLE_EXIT_CLEANUP(candidate2, "bundle_create", watchface_editable_candidates_list_destroy(hListHandle); bundle_free(candidate1)); - bundle_add_str(candidate2, "COLOR", "BLUE"); - nRet = watchface_editable_candidates_list_add(hListHandle, candidate2); - PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_candidates_list_add", WatchfaceComplicationGetError(nRet), watchface_editable_candidates_list_destroy(hListHandle); bundle_free(candidate1); bundle_free(candidate2)); - - nRet = watchface_editable_highlight_create(&hHighlight, WATCHFACE_EDITABLE_SHAPE_TYPE_CIRCLE); - PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_highlight_create", WatchfaceComplicationGetError(nRet), watchface_editable_candidates_list_destroy(hListHandle); bundle_free(candidate1); bundle_free(candidate2)); - CHECK_HANDLE_EXIT_CLEANUP(hHighlight, "watchface_editable_highlight_create", watchface_editable_candidates_list_destroy(hListHandle); bundle_free(candidate1); bundle_free(candidate2)); - - nRet = watchface_editable_highlight_set_geometry(hHighlight, GEO_X, GEO_Y, GEO_W, GEO_H); - PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_highlight_set_geometry", WatchfaceComplicationGetError(nRet), bundle_free(candidate1); bundle_free(candidate2); watchface_editable_candidates_list_destroy(hListHandle); watchface_editable_highlight_destroy(hHighlight)); - - nRet = watchface_editable_add_design_element(hEdCon, 0, 0, hListHandle, hHighlight, "Color"); - PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_add_design_element", WatchfaceComplicationGetError(nRet), bundle_free(candidate1); bundle_free(candidate2); watchface_editable_candidates_list_destroy(hListHandle); watchface_editable_highlight_destroy(hHighlight)); - - nRet = watchface_editable_request_edit(hEdCon, updateCb, NULL); - PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_request_edit", WatchfaceComplicationGetError(nRet), bundle_free(candidate1); bundle_free(candidate2); watchface_editable_candidates_list_destroy(hListHandle); watchface_editable_highlight_destroy(hHighlight)); - - bundle_free(candidate1); - bundle_free(candidate2); - watchface_editable_highlight_destroy(hHighlight); - watchface_editable_candidates_list_destroy(hListHandle); - - return nRet; -} - - -/** -* @function RequestEditWithComplicationCb -* @description Callback Function -* @parameters hHandle, nSelectedIdx, eState, pszUserData -* @return NA -*/ -static void RequestEditWithComplicationCb(const watchface_editable_h hHandle, int nSelectedIdx, const watchface_editable_edit_state_e eState, void *pszUserData) -{ - FPRINTF("[Line : %d][%s] entered %s.\\n", __LINE__, API_NAMESPACE, "RequestEditWithComplicationCb"); - g_bCallBackHit = true; - service_app_exit(); - return; -} - -/** -* @function AddComplicationOnEditReadyCb -* @description Callback Function -* @parameters hEdCon, pszEditorAppid, pszUserData -* @return NA -*/ -static void AddComplicationOnEditReadyCb(watchface_editable_container_h hEdCon,const char *pszEditorAppid,void *pszUserData) -{ - FPRINTF("[Line : %d][%s] entered %s.\\n", __LINE__, API_NAMESPACE, "AddComplicationOnEditReadyCb"); - int nRet; - int nEditableId = 1; - complication_h hHandle; - watchface_editable_highlight_h hHighlight; - char *pszXUserData = (char *)pszUserData; - - if(strncmp(pszXUserData, g_pszCheckUserData, strlen(g_pszCheckUserData)) != 0){ - service_app_exit(); - return; - } - nRet = watchface_editable_highlight_create(&hHighlight, WATCHFACE_EDITABLE_SHAPE_TYPE_CIRCLE); - CALLBACK_ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_editable_highlight_create"); - CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_highlight_create", WatchfaceComplicationGetError(nRet)); - CALLBACK_CHECK_HANDLE_EXIT_CLEANUP(hHighlight, "watchface_complication_create", watchface_editable_highlight_destroy(hHighlight)); - - nRet = watchface_editable_highlight_set_geometry(hHighlight, GEO_X, GEO_Y, GEO_W, GEO_H); - CALLBACK_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_highlight_set_geometry", WatchfaceComplicationGetError(nRet), watchface_editable_highlight_destroy(hHighlight)); - - nRet = watchface_complication_create(1, PROVIDER_ID, WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT, WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT, WATCHFACE_COMPLICATION_EVENT_TAP, &hHandle); - CALLBACK_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_create", WatchfaceComplicationGetError(nRet), watchface_editable_highlight_destroy(hHighlight)); - CALLBACK_CHECK_HANDLE_EXIT_CLEANUP(hHandle, "watchface_complication_create", watchface_editable_highlight_destroy(hHighlight)); - - nRet = watchface_editable_add_complication(hEdCon, pszEditorAppid, hHandle, hHighlight); - CALLBACK_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_add_complication", WatchfaceComplicationGetError(nRet), watchface_editable_highlight_destroy(hHighlight);watchface_complication_destroy(hHandle)); - - nRet = watchface_editable_request_edit(hEdCon, RequestEditWithComplicationCb, g_pszCheckUserData); - CALLBACK_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_request_edit", WatchfaceComplicationGetError(nRet), watchface_editable_highlight_destroy(hHighlight);watchface_complication_destroy(hHandle)); - - watchface_editable_highlight_destroy(hHighlight); - watchface_complication_destroy(hHandle); - g_bCallBackHit = true; - service_app_exit(); - return; -} - -/** -* @function GetNthUpdateRequestedCb -* @description Callback Function -* @parameters hHandle, nSelectedIdx, eState, pszUserData -* @return NA -*/ -static void GetNthUpdateRequestedCb(const watchface_editable_h hHandle, int nSelectedIdx, const watchface_editable_edit_state_e eState, void *pszUserData) -{ - FPRINTF("[Line : %d][%s] entered %s.\\n", __LINE__, API_NAMESPACE, "GetNthUpdateRequestedCb"); - int nRet; - int n = 0; - bundle *pszNthData = NULL; - - nRet = watchface_editable_get_nth_data(hHandle, n, &pszNthData); - CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_get_nth_data", WatchfaceComplicationGetError(nRet)); - CALLBACK_CHECK_HANDLE_EXIT(pszNthData, "watchface_editable_get_nth_data"); - bundle_free(pszNthData); - g_bCallBackHit = true; - service_app_exit(); - return; -} - -/** -* @function GetNthOnEditReadyCb -* @description Callback Function -* @parameters hEdCon, pszEditorAppid, pszUserData -* @return NA -*/ -static void GetNthOnEditReadyCb(watchface_editable_container_h hEdCon, const char *pszEditorAppid, void *pszUserData) -{ - FPRINTF("[Line : %d][%s] entered %s.\\n", __LINE__, API_NAMESPACE, "GetNthOnEditReadyCb"); - int nRet = RequestEditWithDesignElements(hEdCon, GetNthUpdateRequestedCb); - if(g_bFeatureNotSupported || g_bIsFeatureMismatched) - return; - CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "RequestEditWithDesignElements", WatchfaceComplicationGetError(nRet)); - return; -} - -/** -* @function UpdateRequestedCb -* @description Callback Function -* @parameters hHandle, nSelectedIdx, eState, pszUserData -* @return NA -*/ -static void UpdateRequestedCb(const watchface_editable_h hHandle,int nSelectedIdx,const watchface_editable_edit_state_e eState,void *pszUserData) -{ - FPRINTF("[Line : %d][%s] entered %s.\\n", __LINE__, API_NAMESPACE, "UpdateRequestedCb"); - g_bCallBackHit = true; - service_app_exit(); - return; -} - -/** -* @function DesignElementOnEditReadyCb -* @description Callback Function -* @parameters hEdCon, pszEditorAppid, pszUserData -* @return NA -*/ -static void DesignElementOnEditReadyCb(watchface_editable_container_h hEdCon,const char *pszEditorAppId,void *pszUserData) -{ - FPRINTF("[Line : %d][%s] entered %s.\\n", __LINE__, API_NAMESPACE, "DesignElementOnEditReadyCb"); - int nRet; - nRet = RequestEditWithDesignElements(hEdCon, UpdateRequestedCb); - if(g_bFeatureNotSupported || g_bIsFeatureMismatched) - return; - CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "RequestEditWithDesignElements", WatchfaceComplicationGetError(nRet)); - g_bCallBackHit = true; - return; -} - -/** -* @function RequestEditOnEditReadyCb -* @description Callback Function -* @parameters hEdCon, pszEditorAppid, pszUserData -* @return NA -*/ -static void RequestEditOnEditReadyCb(watchface_editable_container_h hEdCon,const char *pszEditorAppid,void *pszUserData) -{ - FPRINTF("[Line : %d][%s] entered %s.\\n", __LINE__, API_NAMESPACE, "RequestEditOnEditReadyCb"); - int nRet; - complication_h hHandle; - watchface_editable_highlight_h hHighlight; - - nRet = watchface_editable_highlight_create(&hHighlight,WATCHFACE_EDITABLE_SHAPE_TYPE_CIRCLE); - CALLBACK_ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_editable_highlight_create"); - CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_highlight_create", WatchfaceComplicationGetError(nRet)); - CALLBACK_CHECK_HANDLE_EXIT(hHighlight, "watchface_editable_highlight_create"); - - nRet = watchface_editable_highlight_set_geometry(hHighlight, GEO_X, GEO_Y, GEO_W, GEO_H); - CALLBACK_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_highlight_set_geometry", WatchfaceComplicationGetError(nRet), watchface_editable_highlight_destroy(hHighlight)); - - nRet = watchface_complication_create(0, "org.tizen.sample_provider", WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT, WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT, WATCHFACE_COMPLICATION_EVENT_TAP, &hHandle); - CALLBACK_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_complication_create", WatchfaceComplicationGetError(nRet), watchface_editable_highlight_destroy(hHighlight)); - CALLBACK_CHECK_HANDLE_EXIT_CLEANUP(hHandle, "watchface_complication_create", watchface_editable_highlight_destroy(hHighlight)); - - nRet = watchface_editable_add_complication(hEdCon, 0, hHandle, hHighlight); - CALLBACK_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_add_complication", WatchfaceComplicationGetError(nRet), watchface_editable_highlight_destroy(hHighlight);watchface_complication_destroy(hHandle)); - - nRet = watchface_editable_request_edit(hEdCon, UpdateRequestedCb, NULL); - CALLBACK_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_request_edit", WatchfaceComplicationGetError(nRet), watchface_editable_highlight_destroy(hHighlight);watchface_complication_destroy(hHandle)); - - watchface_editable_highlight_destroy(hHighlight); - watchface_complication_destroy(hHandle); - g_bCallBackHit = true; - service_app_exit(); - return; -} - -/** -* @function WatchfaceEditableEditReadyCb -* @description Callback Function -* @parameters hEdCon, pszEditorAppid, pszUserData -* @return NA -*/ -static void WatchfaceEditableEditReadyCb(watchface_editable_container_h hEdCon, const char *pszEditorAppid, void *pszUserData) -{ - FPRINTF("[Line : %d][%s] entered %s.\\n", __LINE__, API_NAMESPACE, "WatchfaceEditableEditReadyCb"); - g_bCallBackHit = true; - return; -} - -/** -* @function GetCurDataUpdateRequestedCb -* @description Callback Function -* @parameters hHandle, nSelectedIdx, eState, pszUserData -* @return NA -*/ -static void GetCurDataUpdateRequestedCb(const watchface_editable_h hHandle, int nSelectedIdx, const watchface_editable_edit_state_e eState, void *pszUserData) { - - FPRINTF("[Line : %d][%s] entered %s.\\n", __LINE__, API_NAMESPACE, "GetCurDataUpdateRequestedCb"); - bundle *pszCurrData = NULL; - - int nRet = watchface_editable_get_current_data(hHandle, &pszCurrData); - CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_get_current_data", WatchfaceComplicationGetError(nRet)); - CALLBACK_CHECK_HANDLE_EXIT(pszCurrData, "watchface_editable_get_current_data"); - - bundle_free(pszCurrData); - g_bCallBackHit = true; - return; -} - -/** -* @function GetCurDataOnEditReadyCb -* @description Callback Function -* @parameters hEdCon, pszEditorAppid, pszUserData -* @return NA -*/ -static void GetCurDataOnEditReadyCb(watchface_editable_container_h hEdCon, const char *pszEditorAppid, void *pszUserData) { - - FPRINTF("[Line : %d][%s] entered %s.\\n", __LINE__, API_NAMESPACE, "GetCurDataOnEditReadyCb"); - int nRet = RequestEditWithDesignElements(hEdCon, GetCurDataUpdateRequestedCb); - if(g_bFeatureNotSupported || g_bIsFeatureMismatched) - return; - CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "RequestEditWithDesignElements", WatchfaceComplicationGetError(nRet)); - g_bCallBackHit = true; - return; -} - -/** -* @function GetCurDataIdxUpdateRequestedCb -* @description Callback Function -* @parameters hHandle, nSelectedIdx, eState, pszUserData -* @return NA -*/ -static void GetCurDataIdxUpdateRequestedCb(const watchface_editable_h hHandle, int nSelectedIdx, const watchface_editable_edit_state_e eState, void *pszUserData) -{ - FPRINTF("[Line : %d][%s] entered %s.\\n", __LINE__, API_NAMESPACE, "GetCurDataIdxUpdateRequestedCb"); - int nRet; - int nIdx = -1; - - nRet = watchface_editable_get_current_data_idx(hHandle, &nIdx); - CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_get_current_data_idx", WatchfaceComplicationGetError(nRet)); - if(nIdx < 0) - { - FPRINTF("[Line : %d][%s] %s failed. nIdx = %d\\n", __LINE__, API_NAMESPACE, "watchface_editable_get_current_data_idx", nIdx); - service_app_exit(); - return; - } - - g_bCallBackHit = true; - service_app_exit(); - return; -} - -/** -* @function GetCurDataIdxOnEditReadyCb -* @description Callback Function -* @parameters hEdCon, pszEditorAppid, pszUserData -* @return NA -*/ -static void GetCurDataIdxOnEditReadyCb(watchface_editable_container_h hEdCon, const char *pszEditorAppid, void *pszUserData) { - - FPRINTF("[Line : %d][%s] entered %s.\\n", __LINE__, API_NAMESPACE, "GetCurDataIdxOnEditReadyCb"); - int nRet = RequestEditWithDesignElements(hEdCon, GetCurDataIdxUpdateRequestedCb); - if(g_bFeatureNotSupported || g_bIsFeatureMismatched) - return; - CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "RequestEditWithDesignElements", WatchfaceComplicationGetError(nRet)); - return; -} - -/** -* @function GetEditableIdUpdateRequestedCb -* @description Callback Function -* @parameters hHandle, nSelectedIdx, eState, pszUserData -* @return NA -*/ -static void GetEditableIdUpdateRequestedCb(const watchface_editable_h hHandle, int nSelectedIdx, const watchface_editable_edit_state_e eState, void *pszUserData){ - - FPRINTF("[Line : %d][%s] entered %s.\\n", __LINE__, API_NAMESPACE, "GetEditableIdUpdateRequestedCb"); - int nEditableId = -1; - int nRet = watchface_editable_get_editable_id(hHandle, &nEditableId); - CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_get_editable_id", WatchfaceComplicationGetError(nRet)); - if(nEditableId < 0) - { - FPRINTF("[Line : %d][%s] %s failed. nEditableId = %d\\n", __LINE__, API_NAMESPACE, "watchface_editable_get_editable_id", nEditableId); - service_app_exit(); - return; - } - g_bCallBackHit = true; - service_app_exit(); - return; -} - -/** -* @function GetEditableIdOnEditReadyCb -* @description Callback Function -* @parameters hEdCon, pszEditorAppid, pszUserData -* @return NA -*/ -static void GetEditableIdOnEditReadyCb(watchface_editable_container_h hEdCon, const char *pszEditorAppid, void *pszUserData) { - - FPRINTF("[Line : %d][%s] entered %s.\\n", __LINE__, API_NAMESPACE, "GetEditableIdOnEditReadyCb"); - int nRet = RequestEditWithDesignElements(hEdCon, GetEditableIdUpdateRequestedCb); - if(g_bFeatureNotSupported || g_bIsFeatureMismatched) - return; - CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "RequestEditWithDesignElements", WatchfaceComplicationGetError(nRet)); - return; -} - -/** -* @function LoadCurrentDataUpdateRequestedCb -* @description Callback Function -* @parameters hHandle, nSelectedIdx, eState, pszUserData -* @return NA -*/ -static void LoadCurrentDataUpdateRequestedCb(const watchface_editable_h hHandle,int nSelectedIdx,const watchface_editable_edit_state_e eState,void *pszUserData) -{ - FPRINTF("[Line : %d][%s] entered %s.\\n", __LINE__, API_NAMESPACE, "LoadCurrentDataUpdateRequestedCb"); - int nEditableId = -1; - int nRet; - bundle *pszCurrentData = NULL; - - if(eState == WATCHFACE_EDITABLE_EDIT_STATE_COMPLETE){ - nRet = watchface_editable_get_editable_id(hHandle, &nEditableId); - CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_get_editable_id", WatchfaceComplicationGetError(nRet)); - if(nEditableId < 0) - { - FPRINTF("[Line : %d][%s] %s failed. nEditableId = %d\\n", __LINE__, API_NAMESPACE, "watchface_editable_get_editable_id", nEditableId); - service_app_exit(); - return; - } - nRet = watchface_editable_load_current_data(nEditableId, &pszCurrentData); - CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_load_current_data", WatchfaceComplicationGetError(nRet)); - CALLBACK_CHECK_HANDLE_EXIT(pszCurrentData, "watchface_editable_load_current_data"); - FREE_MEMORY(pszCurrentData); - g_bCallBackHit = true; - } - service_app_exit(); - return; -} - -/** -* @function LoadCurrentDataOnEditReadyCb -* @description Callback Function -* @parameters hEdCon, pszEditorAppid, pszUserData -* @return NA -*/ -static void LoadCurrentDataOnEditReadyCb(watchface_editable_container_h hEdCon,const char *pszEditorAppid,void *pszUserData) { - - FPRINTF("[Line : %d][%s] entered %s.\\n", __LINE__, API_NAMESPACE, "LoadCurrentDataOnEditReadyCb"); - int nRet = RequestEditWithDesignElements(hEdCon, LoadCurrentDataUpdateRequestedCb); - if(g_bFeatureNotSupported || g_bIsFeatureMismatched) - return; - CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "RequestEditWithDesignElements", WatchfaceComplicationGetError(nRet)); - return; -} - -/** -* @function EditableSetNameUpdateRequestedCb -* @description Callback Function -* @parameters hHandle, nSelectedIdx, eState, pszUserData -* @return NA -*/ -static void EditableSetNameUpdateRequestedCb(const watchface_editable_h hHandle,int nSelectedIdx,const watchface_editable_edit_state_e eState,void *pszUserData) -{ - FPRINTF("[Line : %d][%s] entered %s.\\n", __LINE__, API_NAMESPACE, "EditableSetNameUpdateRequestedCb"); - int nRet = watchface_editable_set_editable_name(hHandle, pszEditableSetName); - CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_set_editable_name", WatchfaceComplicationGetError(nRet)); - g_bCallBackHit = true; - service_app_exit(); - return; -} - -/** -* @function EditableSetNameOnEditReadyCb -* @description Callback Function -* @parameters hEdCon, pszEditorAppid, pszUserData -* @return NA -*/ -static void EditableSetNameOnEditReadyCb(watchface_editable_container_h hEdCon,const char *pszEditorAppid,void *pszUserData) { - - FPRINTF("[Line : %d][%s] entered %s.\\n", __LINE__, API_NAMESPACE, "EditableSetNameOnEditReadyCb"); - int nRet = RequestEditWithDesignElements(hEdCon, EditableSetNameUpdateRequestedCb); - if(g_bFeatureNotSupported || g_bIsFeatureMismatched) - return; - CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "RequestEditWithDesignElements", WatchfaceComplicationGetError(nRet)); - return; -} - -/** -* @function EditableGetNameUpdateRequestedCb -* @description Callback Function -* @parameters hHandle, nSelectedIdx, eState, pszUserData -* @return NA -*/ -static void EditableGetNameUpdateRequestedCb(const watchface_editable_h hHandle,int nSelectedIdx,const watchface_editable_edit_state_e eState,void *pszUserData) { - - FPRINTF("[Line : %d][%s] entered %s.\\n", __LINE__, API_NAMESPACE, "EditableGetNameUpdateRequestedCb"); - int nRet = watchface_editable_set_editable_name(hHandle, pszEditableSetName); - CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_set_editable_name", WatchfaceComplicationGetError(nRet)); - - nRet = watchface_editable_get_editable_name(hHandle, &g_pszEditableGetName); - CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_get_editable_name", WatchfaceComplicationGetError(nRet)); - CALLBACK_CHECK_HANDLE_EXIT(g_pszEditableGetName, "watchface_editable_get_editable_name"); - - g_bCallBackHit = true; - service_app_exit(); - return; -} - -/** -* @function EditableGetNameOnEditReadyCb -* @description Callback Function -* @parameters hEdCon, pszEditorAppid, pszUserData -* @return NA -*/ -static void EditableGetNameOnEditReadyCb(watchface_editable_container_h hEdCon,const char *pszEditorAppid,void *pszUserData) { - - FPRINTF("[Line : %d][%s] entered %s.\\n", __LINE__, API_NAMESPACE, "EditableGetNameOnEditReadyCb"); - int nRet = RequestEditWithDesignElements(hEdCon, EditableGetNameUpdateRequestedCb); - if(g_bFeatureNotSupported || g_bIsFeatureMismatched) - return; - CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "RequestEditWithDesignElements", WatchfaceComplicationGetError(nRet)); - return; -} - -/** -* @function GetHighlightUpdateRequestedCb -* @description Callback Function -* @parameters hHandle, nSelectedIdx, eState, pszUserData -* @return NA -*/ -static void GetHighlightUpdateRequestedCb(const watchface_editable_h hHandle, int nSelectedIdx, const watchface_editable_edit_state_e eState, void *pszUserData) { - - FPRINTF("[Line : %d][%s] entered %s.\\n", __LINE__, API_NAMESPACE, "GetHighlightUpdateRequestedCb"); - watchface_editable_highlight_h highlight; - int nX; - int nY; - int nW; - int nH; - - int nRet = watchface_editable_get_highlight(hHandle, &highlight); - CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_get_highlight", WatchfaceComplicationGetError(nRet)); - CALLBACK_CHECK_HANDLE_EXIT(highlight, "watchface_editable_get_highlight"); - - nRet = watchface_editable_highlight_get_geometry(highlight, &nX, &nY, &nW, &nH); - CALLBACK_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_highlight_get_geometry", WatchfaceComplicationGetError(nRet), watchface_editable_highlight_destroy(highlight)); - - if( nX != GEO_X || nY != GEO_Y || nW != GEO_W || nH != GEO_H) - { - FPRINTF("[Line : %d][%s] %s failed. \\nnX = %d\\nnY = %d\\nnW = %d\\nnH = %d\\n", __LINE__, API_NAMESPACE, "watchface_editable_highlight_get_geometry", nX, nY, nH, nW); - watchface_editable_highlight_destroy(highlight); - service_app_exit(); - return; - } - - watchface_editable_highlight_destroy(highlight); - g_bCallBackHit = true; - service_app_exit(); - return; -} - -/** -* @function GetHighlightOnEditReadyCb -* @description Callback Function -* @parameters hEdCon, pszEditorAppid, pszUserData -* @return NA -*/ -static void GetHighlightOnEditReadyCb(watchface_editable_container_h hEdCon, const char *pszEditorAppid, void *pszUserData) -{ - FPRINTF("[Line : %d][%s] entered %s.\\n", __LINE__, API_NAMESPACE, "GetHighlightOnEditReadyCb"); - int nRet = RequestEditWithDesignElements(hEdCon, GetHighlightUpdateRequestedCb); - if(g_bFeatureNotSupported || g_bIsFeatureMismatched) - return; - CALLBACK_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "RequestEditWithDesignElements", WatchfaceComplicationGetError(nRet)); - return; -} - -/*****************************************************Callback End*****************************************************/ - -//& purpose: To create candidate list and adds candidate data to the candidate list and destroy candidates list -//& type: auto -/** -* @testcase ITc_watchface_editable_candidates_list_create_add_destroy_p -* @since_tizen 5.0 -* @author SRID(p.chauhan) -* @reviewer SRID(manoj.g2) -* @type auto -* @description Creates candidates list, Adds candidate data to the candidates list and Destroys candidates list. -* @scenario Creates candidates list, Adds candidate data to the candidates list and Destroys candidates list. -* @apicovered watchface_editable_candidates_list_create, watchface_editable_candidates_list_add, watchface_editable_candidates_list_destroy -* @passcase Target APIs return 0 -* @failcase Target APIs return 1 -* @precondition N/A -* @postcondition N/A -* */ -int ITc_watchface_editable_candidates_list_create_add_destroy_p(void) -{ - START_TEST; - complication_candidates_list_h hHandle = NULL; - bundle *pszCandidate = NULL; - - int nRet = watchface_editable_candidates_list_create(&hHandle); - ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_editable_candidates_list_create"); - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_candidates_list_create", WatchfaceComplicationGetError(nRet)); - CHECK_HANDLE_EXIT(hHandle, "watchface_editable_candidates_list_create"); - - pszCandidate = bundle_create(); - nRet = get_last_result(); - PRINT_RESULT_EXIT_CLEANUP(nRet, BUNDLE_ERROR_NONE, "bundle_create", BundleGetError(nRet), watchface_editable_candidates_list_destroy(hHandle)); - CHECK_HANDLE_EXIT_CLEANUP(pszCandidate, "bundle_create", watchface_editable_candidates_list_destroy(hHandle)); - bundle_add_str(pszCandidate, "COLOR", "RED"); - nRet = watchface_editable_candidates_list_add(hHandle, pszCandidate); - PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_candidates_list_add", WatchfaceComplicationGetError(nRet), watchface_editable_candidates_list_destroy(hHandle)); - CHECK_HANDLE_EXIT_CLEANUP(pszCandidate, "watchface_editable_candidates_list_add", watchface_editable_candidates_list_destroy(hHandle)); - bundle_free(pszCandidate); - - nRet = watchface_editable_candidates_list_destroy(hHandle); - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_candidates_list_destroy", WatchfaceComplicationGetError(nRet)); - - service_app_exit(); - return 0; -} - -//& purpose: To add complication to editable container -//& type: auto -/** -* @testcase ITc_watchface_editable_add_complication_p -* @since_tizen 5.0 -* @author SRID(p.chauhan) -* @reviewer SRID(manoj.g2) -* @type auto -* @description Adds complication to editable container. -* @scenario Adds complication to editable container. -* @apicovered watchface_editable_highlight_create, watchface_editable_highlight_set_geometry, watchface_complication_create, watchface_editable_add_complication, watchface_editable_request_edit -* @passcase Target APIs return 0 -* @failcase Target APIs return 1 -* @precondition Editable handle should be created by watchface_editable_highlight_create(). -* @postcondition N/A -* */ -int ITc_watchface_editable_add_complication_p(void) -{ - START_TEST; - int nRet = watchface_editable_add_edit_ready_cb(AddComplicationOnEditReadyCb, g_pszCheckUserData); - if(g_bFeatureNotSupported) - return 0; - if(g_bIsFeatureMismatched) - return 1; - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_add_edit_ready_cb", WatchfaceComplicationGetError(nRet)); - - g_bCallBackHit = false; - RunEditorApp(); - IterateGmainLoop(); - - if(!g_bCallBackHit) - { - FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "RequestEditWithComplicationCb"); - nRet = watchface_editable_remove_edit_ready_cb(AddComplicationOnEditReadyCb); - PRINT_RESULT_EXIT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); - return 1; - } - nRet = watchface_editable_remove_edit_ready_cb(AddComplicationOnEditReadyCb); - PRINT_RESULT_EXIT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 0; -} - -//& purpose: To get the nth data of the editable -//& type: auto -/** -* @testcase ITc_watchface_editable_get_nth_data_p -* @since_tizen 5.0 -* @author SRID(p.chauhan) -* @reviewer SRID(manoj.g2) -* @type auto -* @description Gets the nth data of the editable. -* @scenario Gets the nth data of the editable. -* @apicovered watchface_editable_get_nth_data -* @passcase watchface_editable_get_nth_data returns 0 -* @failcase watchface_editable_get_nth_data returns 1 -* @precondition N/A -* @postcondition N/A -* */ -int ITc_watchface_editable_get_nth_data_p(void) -{ - START_TEST; - int nRet = 0; - g_bCallBackHit = false; - nRet = watchface_editable_add_edit_ready_cb(GetNthOnEditReadyCb, NULL); - if(g_bFeatureNotSupported) - return 0; - if(g_bIsFeatureMismatched) - return 1; - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_add_edit_ready_cb", WatchfaceComplicationGetError(nRet)); - - RunEditorApp(); - IterateGmainLoop(); - - if(!g_bCallBackHit) - { - FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "GetNthUpdateRequestedCb"); - nRet = watchface_editable_remove_edit_ready_cb(GetNthOnEditReadyCb); - PRINT_RESULT_EXIT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); - return 1; - } - nRet = watchface_editable_remove_edit_ready_cb(GetNthOnEditReadyCb); - PRINT_RESULT_EXIT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 0; -} - -//& purpose: To add the design element to the editable container handle -//& type: auto -/** -* @testcase ITc_watchface_editable_add_design_element_p -* @since_tizen 5.0 -* @author SRID(p.chauhan) -* @reviewer SRID(manoj.g2) -* @type auto -* @description Adds the design element to the editable container handle. -* @scenario Adds the design element to the editable container handle. -* @apicovered watchface_editable_add_design_element -* @passcase returns 0 -* @failcase returns 1 -* @precondition N/A -* @postcondition N/A -* */ -int ITc_watchface_editable_add_design_element_p(void) -{ - START_TEST; - g_bCallBackHit = false; - int nRet = watchface_editable_add_edit_ready_cb(DesignElementOnEditReadyCb, NULL); - if(g_bFeatureNotSupported) - return 0; - if(g_bIsFeatureMismatched) - return 1; - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_add_edit_ready_cb", WatchfaceComplicationGetError(nRet)); - - RunEditorApp(); - IterateGmainLoop(); - - if(!g_bCallBackHit) - { - FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "UpdateRequestedCb"); - nRet = watchface_editable_remove_edit_ready_cb(DesignElementOnEditReadyCb); - PRINT_RESULT_EXIT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 1; - } - nRet = watchface_editable_remove_edit_ready_cb(DesignElementOnEditReadyCb); - PRINT_RESULT_EXIT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 0; -} - -//& purpose: To request editor to edit -//& type: auto -/** -* @testcase ITc_watchface_editable_request_edit_p -* @since_tizen 5.0 -* @author SRID(p.chauhan) -* @reviewer SRID(manoj.g2) -* @type auto -* @description Requests editor to edit. -* @scenario Requests editor to edit. -* @apicovered watchface_editable_request_edit -* @passcase Target APIs return 0 -* @failcase Target APIs return 1 -* @precondition Editable handle should be created by watchface_editable_highlight_create(). -* @postcondition N/A -* */ -int ITc_watchface_editable_request_edit_p(void) -{ - START_TEST; - int nRet = watchface_editable_add_edit_ready_cb(RequestEditOnEditReadyCb, NULL); - if(g_bFeatureNotSupported) - return 0; - if(g_bIsFeatureMismatched) - return 1; - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_add_edit_ready_cb", WatchfaceComplicationGetError(nRet)); - - RunEditorApp(); - IterateGmainLoop(); - - if(!g_bCallBackHit) - { - FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "UpdateRequestedCb"); - nRet = watchface_editable_remove_edit_ready_cb(DesignElementOnEditReadyCb); - PRINT_RESULT_EXIT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 1; - } - nRet = watchface_editable_remove_edit_ready_cb(RequestEditOnEditReadyCb); - PRINT_RESULT_EXIT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); - return 0; -} - -//& purpose: To add and remove the callback function to request edit -//& type: auto -/** -* @testcase ITc_watchface_editable_add_remove_edit_ready_cb_p -* @since_tizen 5.0 -* @author SRID(p.chauhan) -* @reviewer SRID(manoj.g2) -* @type auto -* @description Adds and removes the callback function to request edit. -* @scenario Adds and removes the callback function to request edit. -* @apicovered watchface_editable_add_edit_ready_cb, watchface_editable_remove_edit_ready_cb -* @passcase Target APIs return 0 -* @failcase target APIs return 1 -* @precondition N/A -* @postcondition N/A -* */ -int ITc_watchface_editable_add_remove_edit_ready_cb_p(void) -{ - START_TEST; - g_bCallBackHit = false; - int nRet = watchface_editable_add_edit_ready_cb(WatchfaceEditableEditReadyCb, NULL); - ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_editable_add_edit_ready_cb"); - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_add_edit_ready_cb", WatchfaceComplicationGetError(nRet)); - RunEditorApp(); - IterateGmainLoop(); - if(!g_bCallBackHit) - { - FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "WatchfaceEditableEditReadyCb"); - nRet = watchface_editable_remove_edit_ready_cb(WatchfaceEditableEditReadyCb); - PRINT_RESULT_EXIT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 1; - } - nRet = watchface_editable_remove_edit_ready_cb(WatchfaceEditableEditReadyCb); - PRINT_RESULT_EXIT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 0; -} - -//& purpose: To get the current data in editable -//& type: auto -/** -* @testcase ITc_watchface_editable_get_current_data_p -* @since_tizen 5.0 -* @author SRID(p.chauhan) -* @reviewer SRID(manoj.g2) -* @type auto -* @description Gets the current data in editable. -* @scenario Gets the current data in editable. -* @apicovered watchface_editable_get_current_data -* @passcase watchface_editable_get_current_data returns 0 -* @failcase watchface_editable_get_current_data returns 1 -* @precondition N/A -* @postcondition N/A -* */ -int ITc_watchface_editable_get_current_data_p(void) -{ - START_TEST; - watchface_editable_h hHandle = NULL; - g_bCallBackHit = false; - - int nRet = watchface_editable_add_edit_ready_cb(GetCurDataOnEditReadyCb, NULL); - if(g_bFeatureNotSupported) - return 0; - if(g_bIsFeatureMismatched) - return 1; - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_add_edit_ready_cb", WatchfaceComplicationGetError(nRet)); - - RunEditorApp(); - IterateGmainLoop(); - - if(!g_bCallBackHit) - { - FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "GetCurDataUpdateRequestedCb"); - nRet = watchface_editable_remove_edit_ready_cb(GetCurDataOnEditReadyCb); - PRINT_RESULT_EXIT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 1; - } - nRet = watchface_editable_remove_edit_ready_cb(GetCurDataOnEditReadyCb); - PRINT_RESULT_EXIT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 0; -} - -//& purpose: To get the index of current data -//& type: auto -/** -* @testcase ITc_watchface_editable_get_current_data_idx_p -* @since_tizen 5.0 -* @author SRID(p.chauhan) -* @reviewer SRID(manoj.g2) -* @type auto -* @description Gets the index of current data. -* @scenario Gets the index of current data. -* @apicovered watchface_editable_get_current_data_idx -* @passcase watchface_editable_get_current_data_idx returns 0 -* @failcase watchface_editable_get_current_data_idx returns 1 -* @precondition N/A -* @postcondition N/A -* */ -int ITc_watchface_editable_get_current_data_idx_p(void) -{ - START_TEST; - watchface_editable_h hHandle = NULL; - g_bCallBackHit = false; - - int nRet = watchface_editable_add_edit_ready_cb(GetCurDataIdxOnEditReadyCb, NULL); - if(g_bFeatureNotSupported) - return 0; - if(g_bIsFeatureMismatched) - return 1; - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_add_edit_ready_cb", WatchfaceComplicationGetError(nRet)); - - RunEditorApp(); - IterateGmainLoop(); - - if(!g_bCallBackHit) - { - FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "GetCurDataIdxUpdateRequestedCb"); - nRet = watchface_editable_remove_edit_ready_cb(GetCurDataIdxOnEditReadyCb); - PRINT_RESULT_EXIT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 1; - } - nRet = watchface_editable_remove_edit_ready_cb(GetCurDataIdxOnEditReadyCb); - PRINT_RESULT_EXIT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 0; -} - -//& purpose: To get the id of editable -//& type: auto -/** -* @testcase ITc_watchface_editable_get_editable_id_p -* @since_tizen 5.0 -* @author SRID(p.chauhan) -* @reviewer SRID(manoj.g2) -* @type auto -* @description Gets the id of editable. -* @scenario Gets the id of editable. -* @apicovered watchface_editable_get_editable_id -* @passcase watchface_editable_get_editable_id returns 0 -* @failcase watchface_editable_get_editable_id returns 1 -* @precondition N/A -* @postcondition N/A -* */ -int ITc_watchface_editable_get_editable_id_p(void) -{ - START_TEST; - watchface_editable_h hHandle = NULL; - g_bCallBackHit = false; - - int nRet = watchface_editable_add_edit_ready_cb(GetEditableIdOnEditReadyCb, NULL); - if(g_bFeatureNotSupported) - return 0; - if(g_bIsFeatureMismatched) - return 1; - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_add_edit_ready_cb", WatchfaceComplicationGetError(nRet)); - - RunEditorApp(); - IterateGmainLoop(); - - if(!g_bCallBackHit) - { - FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "GetEditableIdUpdateRequestedCb"); - nRet = watchface_editable_remove_edit_ready_cb(GetEditableIdOnEditReadyCb); - PRINT_RESULT_EXIT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 1; - } - nRet = watchface_editable_remove_edit_ready_cb(GetEditableIdOnEditReadyCb); - PRINT_RESULT_EXIT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 0; -} - -//& purpose: To get the editable information of the specified Id -//& type: auto -/** -* @testcase ITc_watchface_editable_load_current_data_p -* @since_tizen 5.0 -* @author SRID(p.chauhan) -* @reviewer SRID(manoj.g2) -* @type auto -* @description Gets the editable information of the specified Id. -* @scenario Gets the editable information of the specified Id. -* @apicovered watchface_editable_get_editable_id, watchface_editable_load_current_data -* @passcase Target APIs return 0 -* @failcase Target APIs return 1 -* @precondition Get specified Id by watchface_editable_get_editable_id() -* @postcondition N/A -* */ -int ITc_watchface_editable_load_current_data_p(void) -{ - START_TEST; - g_bCallBackHit = false; - int nRet = watchface_editable_add_edit_ready_cb(LoadCurrentDataOnEditReadyCb, NULL); - if(g_bFeatureNotSupported) - return 0; - if(g_bIsFeatureMismatched) - return 1; - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_add_edit_ready_cb", WatchfaceComplicationGetError(nRet)); - - RunEditorApp(); - IterateGmainLoop(); - - if(!g_bCallBackHit) - { - FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "LoadCurrentDataUpdateRequestedCb"); - nRet = watchface_editable_remove_edit_ready_cb(LoadCurrentDataOnEditReadyCb); - PRINT_RESULT_EXIT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 1; - } - - nRet = watchface_editable_remove_edit_ready_cb(LoadCurrentDataOnEditReadyCb); - PRINT_RESULT_EXIT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 0; -} - -//& purpose: To set the name in editable -//& type: auto -/** -* @testcase ITc_watchface_editable_set_editable_name_p -* @since_tizen 5.0 -* @author SRID(p.chauhan) -* @reviewer SRID(manoj.g2) -* @type auto -* @description Sets the name in editable. -* @scenario Sets the name in editable. -* @apicovered watchface_editable_set_editable_name -* @passcase watchface_editable_set_editable_name returns 0 -* @failcase watchface_editable_set_editable_name returns 1 -* @precondition N/A -* @postcondition N/A -* */ -int ITc_watchface_editable_set_editable_name_p(void) -{ - START_TEST; - int nRet = 0; - g_bCallBackHit = false; - nRet = watchface_editable_add_edit_ready_cb(EditableSetNameOnEditReadyCb, NULL); - if(g_bFeatureNotSupported) - return 0; - if(g_bIsFeatureMismatched) - return 1; - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_add_edit_ready_cb", WatchfaceComplicationGetError(nRet)); - - RunEditorApp(); - IterateGmainLoop(); - - if(!g_bCallBackHit) - { - FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "EditableSetNameUpdateRequestedCb"); - nRet = watchface_editable_remove_edit_ready_cb(EditableSetNameOnEditReadyCb); - PRINT_RESULT_EXIT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 1; - } - nRet = watchface_editable_remove_edit_ready_cb(EditableSetNameOnEditReadyCb); - PRINT_RESULT_EXIT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 0; -} - -//& purpose: To get the name of editable -//& type: auto -/** -* @testcase ITc_watchface_editable_get_editable_name_p -* @since_tizen 5.0 -* @author SRID(p.chauhan) -* @reviewer SRID(manoj.g2) -* @type auto -* @description Gets the id of editable. -* @scenario Gets the id of editable. -* @apicovered watchface_editable_set_editable_name,watchface_editable_get_editable_name -* @passcase Target APIs return 0 -* @failcase Target APIs return 1 -* @precondition Set Id by watchface_editable_set_editable_name() -* @postcondition N/A -* */ -int ITc_watchface_editable_get_editable_name_p(void) -{ - START_TEST; - int nRet; - g_bCallBackHit = false; - - nRet = watchface_editable_add_edit_ready_cb(EditableGetNameOnEditReadyCb, NULL); - if(g_bFeatureNotSupported) - return 0; - if(g_bIsFeatureMismatched) - return 1; - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_add_edit_ready_cb", WatchfaceComplicationGetError(nRet)); - - RunEditorApp(); - IterateGmainLoop(); - - if(strncmp(g_pszEditableGetName, pszEditableSetName, strlen(pszEditableSetName))!= 0) - { - FPRINTF("[Line : %d][%s] %s failed. g_pszEditableGetName = %s\\n", __LINE__, API_NAMESPACE, "watchface_editable_get_editable_name", g_pszEditableGetName); - nRet = watchface_editable_remove_edit_ready_cb(EditableGetNameOnEditReadyCb); - PRINT_RESULT_EXIT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 1; - } - FREE_MEMORY(g_pszEditableGetName); - - if(!g_bCallBackHit) - { - FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "EditableGetNameUpdateRequestedCb"); - nRet = watchface_editable_remove_edit_ready_cb(EditableGetNameOnEditReadyCb); - PRINT_RESULT_EXIT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 1; - } - - nRet = watchface_editable_remove_edit_ready_cb(EditableGetNameOnEditReadyCb); - PRINT_RESULT_EXIT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 0; -} - -//& purpose: To get editable's highlight handle -//& type: auto -/** -* @testcase ITc_watchface_editable_get_highlight_p -* @since_tizen 5.0 -* @author SRID(p.chauhan) -* @reviewer SRID(manoj.g2) -* @type auto -* @description Gets editable's highlight handle. -* @scenario Gets editable's highlight handle. -* @apicovered watchface_editable_get_highlight, watchface_editable_highlight_get_geometry -* @passcase Target APIs return 0 -* @failcase Target APIs return 1 -* @precondition Gets highlight by watchface_editable_get_highlight() -* @postcondition N/A -* */ -int ITc_watchface_editable_get_highlight_p(void) -{ - START_TEST; - int nRet = watchface_editable_add_edit_ready_cb(GetHighlightOnEditReadyCb, NULL); - if(g_bFeatureNotSupported) - return 0; - if(g_bIsFeatureMismatched) - return 1; - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_add_edit_ready_cb", WatchfaceComplicationGetError(nRet)); - - g_bCallBackHit = false; - RunEditorApp(); - IterateGmainLoop(); - - if(!g_bCallBackHit) - { - FPRINTF("[Line : %d][%s] %s was not hit.\\n", __LINE__, API_NAMESPACE, "GetHighlightUpdateRequestedCb"); - nRet = watchface_editable_remove_edit_ready_cb(GetHighlightOnEditReadyCb); - PRINT_RESULT_EXIT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 1; - } - - nRet = watchface_editable_remove_edit_ready_cb(GetHighlightOnEditReadyCb); - PRINT_RESULT_EXIT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_remove_edit_ready_cb", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 0; -} - -//& purpose: To set and get editable's highlight geometry info -//& type: auto -/** -* @testcase ITc_watchface_editable_set_get_geometry_p -* @since_tizen 5.0 -* @author SRID(p.chauhan) -* @reviewer SRID(manoj.g2) -* @type auto -* @description Sets and gets editable's highlight geometry info. -* @scenario Sets and gets editable's highlight geometry info. -* @apicovered watchface_editable_highlight_set_geometry, watchface_editable_highlight_get_geometry -* @passcase Target APIs return 0 -* @failcase Target APIs return 1 -* @precondition N/A -* @postcondition N/A -* */ -int ITc_watchface_editable_set_get_geometry_p(void) -{ - START_TEST; - int nRet = 0; - int nX; - int nY; - int nW; - int nH; - watchface_editable_highlight_h hHandle; - - nRet = watchface_editable_highlight_create(&hHandle, WATCHFACE_EDITABLE_SHAPE_TYPE_CIRCLE); - ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_editable_highlight_create"); - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_highlight_create", WatchfaceComplicationGetError(nRet)); - CHECK_HANDLE_EXIT(hHandle, "watchface_editable_highlight_create"); - - nRet = watchface_editable_highlight_set_geometry(hHandle, GEO_X, GEO_Y, GEO_W, GEO_H); - PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_highlight_set_geometry", WatchfaceComplicationGetError(nRet), watchface_editable_highlight_destroy(hHandle)); - - nRet = watchface_editable_highlight_get_geometry(hHandle, &nX, &nY, &nW, &nH); - PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_highlight_get_geometry", WatchfaceComplicationGetError(nRet), watchface_editable_highlight_destroy(hHandle)); - - if( nX != GEO_X || nY != GEO_Y || nW != GEO_W || nH != GEO_H) - { - FPRINTF("[Line : %d][%s] %s failed. \\nnX = %d\\nnY = %d\\nnW = %d\\nnH = %d\\n", __LINE__, API_NAMESPACE, "watchface_editable_highlight_get_geometry", nX, nY, nH, nW); - nRet = watchface_editable_highlight_destroy(hHandle); - PRINT_RESULT_EXIT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_highlight_destroy", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 1; - } - - nRet = watchface_editable_highlight_destroy(hHandle); - PRINT_RESULT_EXIT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_highlight_destroy", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 0; -} - -//& purpose: To set and get editable's highlight shape type -//& type: auto -/** -* @testcase ITc_watchface_editable_highlight_set_get_shape_type_p -* @since_tizen 5.0 -* @author SRID(p.chauhan) -* @reviewer SRID(manoj.g2) -* @type auto -* @description Sets and Gets editable's highlight shape type. -* @scenario Sets and Gets editable's highlight shape type. -* @apicovered watchface_editable_highlight_set_shape_type, watchface_editable_highlight_get_shape_type -* @passcase Target APIs return 0 -* @failcase Target APIs return 1 -* @precondition N/A -* @postcondition N/A -* */ -int ITc_watchface_editable_highlight_set_get_shape_type_p(void) -{ - START_TEST; - int nRet; - watchface_editable_highlight_h hHandle; - watchface_editable_shape_type_e eShape; - - nRet = watchface_editable_highlight_create(&hHandle, WATCHFACE_EDITABLE_SHAPE_TYPE_CIRCLE); - ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_editable_highlight_create"); - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_highlight_create", WatchfaceComplicationGetError(nRet)); - - nRet = watchface_editable_highlight_set_shape_type(hHandle, WATCHFACE_EDITABLE_SHAPE_TYPE_RECT); - PRINT_RESULT_EXIT_CLEANUP(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_highlight_set_shape_type", WatchfaceComplicationGetError(nRet), watchface_editable_highlight_destroy(hHandle)); - - nRet = watchface_editable_highlight_get_shape_type(hHandle, &eShape); - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_highlight_get_shape_type", WatchfaceComplicationGetError(nRet)); - - if(eShape != WATCHFACE_EDITABLE_SHAPE_TYPE_RECT) - { - FPRINTF("[Line : %d][%s] %s failed. eShape = %d\\n", __LINE__, API_NAMESPACE, "watchface_editable_highlight_get_geometry", eShape); - nRet = watchface_editable_highlight_destroy(hHandle); - PRINT_RESULT_EXIT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_highlight_destroy", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 1; - } - - nRet = watchface_editable_highlight_destroy(hHandle); - PRINT_RESULT_EXIT_NORETURN(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_highlight_destroy", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 0; -} - -//& purpose: To create and destroy editables highlight -//& type: auto -/** -* @testcase ITc_watchface_editable_highlight_create_destroy_p -* @since_tizen 5.0 -* @author SRID(p.chauhan) -* @reviewer SRID(manoj.g2) -* @type auto -* @description Creates and destroys editables highlight -* @scenario Creates and destroys editables highlight -* @apicovered watchface_editable_highlight_create, watchface_editable_highlight_destroy -* @passcase Target APIs return 0 -* @failcase Target APIs return 1 -* @precondition N/A -* @postcondition N/A; -* */ -int ITc_watchface_editable_highlight_create_destroy_p(void) -{ - START_TEST; - int nRet; - watchface_editable_highlight_h hHandle; - nRet = watchface_editable_highlight_create(&hHandle, WATCHFACE_EDITABLE_SHAPE_TYPE_CIRCLE); - ISFEATURE_SUPPORTED_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED, "watchface_editable_highlight_create"); - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_highlight_create", WatchfaceComplicationGetError(nRet)); - CHECK_HANDLE_EXIT(hHandle, "watchface_editable_highlight_create"); - - nRet = watchface_editable_highlight_destroy(hHandle); - PRINT_RESULT_EXIT(nRet, WATCHFACE_COMPLICATION_ERROR_NONE, "watchface_editable_highlight_destroy", WatchfaceComplicationGetError(nRet)); - service_app_exit(); - return 0; -} - diff --git a/src/itc/watchface/res/wearable/org.tizen.complication_test-1.0.0-arm.tpk b/src/itc/watchface/res/wearable/org.tizen.complication_test-1.0.0-arm.tpk deleted file mode 100644 index 5834120c3..000000000 Binary files a/src/itc/watchface/res/wearable/org.tizen.complication_test-1.0.0-arm.tpk and /dev/null differ diff --git a/src/itc/watchface/res/wearable/org.tizen.complication_test-1.0.0-x86.tpk b/src/itc/watchface/res/wearable/org.tizen.complication_test-1.0.0-x86.tpk deleted file mode 100644 index 132693fe0..000000000 Binary files a/src/itc/watchface/res/wearable/org.tizen.complication_test-1.0.0-x86.tpk and /dev/null differ diff --git a/src/itc/watchface/res/wearable/org.tizen.watchface_sample_editor-1.0.0-arm.tpk b/src/itc/watchface/res/wearable/org.tizen.watchface_sample_editor-1.0.0-arm.tpk deleted file mode 100644 index 275b27e51..000000000 Binary files a/src/itc/watchface/res/wearable/org.tizen.watchface_sample_editor-1.0.0-arm.tpk and /dev/null differ diff --git a/src/itc/watchface/res/wearable/org.tizen.watchface_sample_editor-1.0.0-x86.tpk b/src/itc/watchface/res/wearable/org.tizen.watchface_sample_editor-1.0.0-x86.tpk deleted file mode 100644 index e4eb90196..000000000 Binary files a/src/itc/watchface/res/wearable/org.tizen.watchface_sample_editor-1.0.0-x86.tpk and /dev/null differ diff --git a/src/itc/watchface/res/wearable/org.tizen.watchface_sample_provider-1.0.0-arm.tpk b/src/itc/watchface/res/wearable/org.tizen.watchface_sample_provider-1.0.0-arm.tpk deleted file mode 100644 index cb246f393..000000000 Binary files a/src/itc/watchface/res/wearable/org.tizen.watchface_sample_provider-1.0.0-arm.tpk and /dev/null differ diff --git a/src/itc/watchface/res/wearable/org.tizen.watchface_sample_provider-1.0.0-x86.tpk b/src/itc/watchface/res/wearable/org.tizen.watchface_sample_provider-1.0.0-x86.tpk deleted file mode 100644 index 29e47f1f3..000000000 Binary files a/src/itc/watchface/res/wearable/org.tizen.watchface_sample_provider-1.0.0-x86.tpk and /dev/null differ diff --git a/src/itc/watchface/tct-watchface-native.c b/src/itc/watchface/tct-watchface-native.c deleted file mode 100755 index 0c29ef8c6..000000000 --- a/src/itc/watchface/tct-watchface-native.c +++ /dev/null @@ -1,226 +0,0 @@ -// -// Copyright (c) 2018 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 -#include -#include -#include "tct_common.h" -#include "ITs-watchface-common.h" - -#ifdef WEARABLE //Starts WEARABLE -#include "tct-watchface-native_wearable.h" -#endif //WEARABLE //End WEARABLE -#define COMPLICATION_TEST_APP "org.tizen.complication_test" - -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; - bool bIsEditing = false; - char* pszCallerAppId = NULL; - watchface_complication_event_type_e eEventType = WATCHFACE_COMPLICATION_EVENT_NONE; - - nRet = watchface_complication_provider_setup_is_editing(app_control, &bIsEditing); - if(nRet != WATCHFACE_COMPLICATION_ERROR_NONE) - { - FPRINTF("[Line : %d][%s] watchface_complication_provider_setup_is_editing returned %s error\\n", __LINE__, API_NAMESPACE, WatchfaceComplicationGetError(nRet)); - return; - } - - if (bIsEditing) { - bundle *pszContext = NULL; - char *pszCmd = NULL; - nRet = watchface_complication_provider_setup_get_context(app_control, &pszContext); - if(nRet != WATCHFACE_COMPLICATION_ERROR_NONE) - { - FPRINTF("[Line : %d][%s] watchface_complication_provider_setup_is_editing returned %s error\\n", __LINE__, API_NAMESPACE, WatchfaceComplicationGetError(nRet)); - return; - } - if(pszContext == NULL) - { - FPRINTF("[Line : %d][%s] watchface_complication_provider_setup_is_editing failed, error returned = Handle returned is NULL\\n", __LINE__, API_NAMESPACE); - return; - } - bundle_get_str(pszContext, "CONTEXT_DATA", &pszCmd); - nRet = get_last_result(); - if(nRet != BUNDLE_ERROR_NONE) - { - FPRINTF("[Line : %d][%s] bundle_get_str returned %s error\\n", __LINE__, API_NAMESPACE, BundleGetError(nRet)); - FREE_MEMORY(pszContext); - return; - } - if(pszCmd == NULL) - { - FPRINTF("[Line : %d][%s] bundle_get_str failed, error returned = Handle returned is NULL\\n", __LINE__, API_NAMESPACE); - FREE_MEMORY(pszContext); - return; - } - g_hTestControl = NULL; - nRet = app_control_clone(&g_hTestControl, app_control); - if(nRet != APP_CONTROL_ERROR_NONE) - { - FPRINTF("[Line : %d][%s] app_control_clone returned %s error\\n", __LINE__, API_NAMESPACE, AppControlGetError(nRet)); - FREE_MEMORY(pszContext); - FREE_MEMORY(pszCmd); - return; - } - if(g_hTestControl == NULL) - { - FPRINTF("[Line : %d][%s] app_control_clone failed, error returned = Handle returned is NULL\\n", __LINE__, API_NAMESPACE); - FREE_MEMORY(pszContext); - FREE_MEMORY(pszCmd); - return; - } - if (pszCmd && strcmp(pszCmd, SETUP_IS_EDITING_TEST_VAL) == 0) - WatchfaceComplicationProviderSetupIsEditingChecker(); - else if (pszCmd && strcmp(pszCmd, SETUP_REPLY_TO_EDITOR_TEST_VAL) == 0) - WatchfaceComplicationProviderSetupReplyToEditorChecker(); - else if (pszCmd && strcmp(pszCmd, SETUP_GET_CONTEXT_TEST_VAL) == 0) - WatchfaceComplicationProviderSetupGetContextChecker(); - FREE_MEMORY(pszContext); - FREE_MEMORY(pszCmd); - return; - } - - nRet = watchface_complication_provider_event_get_type(app_control, &eEventType); - if(nRet != WATCHFACE_COMPLICATION_ERROR_NONE) - { - FPRINTF("[Line : %d][%s] watchface_complication_provider_event_get_type returned %s error\\n", __LINE__, API_NAMESPACE, WatchfaceComplicationGetError(nRet)); - return; - } - - if (eEventType != WATCHFACE_COMPLICATION_EVENT_NONE) { - nRet = app_control_clone(&g_hTestControl, app_control); - if(nRet != APP_CONTROL_ERROR_NONE) - { - FPRINTF("[Line : %d][%s] app_control_clone returned %s error\\n", __LINE__, API_NAMESPACE, AppControlGetError(nRet)); - return; - } - if(g_hTestControl == NULL) - { - FPRINTF("[Line : %d][%s] app_control_clone failed, error returned = Handle returned is NULL\\n", __LINE__, API_NAMESPACE); - return; - } - if (g_pszEventCmd && strcmp(g_pszEventCmd, EVENT_GET_EVENT_TYPE_TEST_VAL) == 0) - WatchfaceComplicationProviderEventGetTypeChecker(); - else if (g_pszEventCmd && strcmp(g_pszEventCmd, EVENT_GET_PROVIDER_ID_TEST_VAL) == 0) - WatchfaceComplicationProviderEventGetProviderIdChecker(); - else if (g_pszEventCmd && strcmp(g_pszEventCmd, EVENT_GET_COMP_TYPE_TEST_VAL) == 0) - WatchfaceComplicationProviderEventGetComplicationTypeChecker(); - else if (g_pszEventCmd && strcmp(g_pszEventCmd, EVENT_GET_CONTEXT_TEST_VAL) == 0) - WatchfaceComplicationProviderEventGetContextChecker(); - return; - } - - nRet = app_control_get_caller(app_control, &pszCallerAppId); - if (pszCallerAppId != NULL && strcmp(pszCallerAppId, COMPLICATION_TEST_APP) == 0) { - FREE_MEMORY(pszCallerAppId); - return; - } - FREE_MEMORY(pszCallerAppId); - - 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)) ) - { - 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); - - 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); - app_control_destroy(app_control); - 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; - - service_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 = service_app_main(argc, argv, &event_callback, NULL); - if (ret != APP_ERROR_NONE) - { - dlog_print(DLOG_ERROR, "NativeTCT", "Application service_app_main call gets failed. err = %d", ret); - PRINT_UTC_LOG("\\n[%s][Line : %d]Application service_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/itc/watchface/tct-watchface-native_wearable.h b/src/itc/watchface/tct-watchface-native_wearable.h deleted file mode 100755 index 4c5d999c6..000000000 --- a/src/itc/watchface/tct-watchface-native_wearable.h +++ /dev/null @@ -1,147 +0,0 @@ -// -// Copyright (c) 2018 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_WATCHFACE-NATIVE_H__ -#define __TCT_WATCHFACE-NATIVE_H__ - -#include "testcase.h" -#include "tct_common.h" - - -extern void ITs_watchface_complication_provider_startup(void); -extern void ITs_watchface_complication_provider_cleanup(void); -extern int ITc_watchface_complication_provider_add_remove_update_requested_cb_p(void); -extern int ITc_watchface_complication_provider_notify_update_p(void); -extern int ITc_watchface_complication_provider_setup_get_context_p(void); -extern int ITc_watchface_complication_provider_setup_reply_to_editor_p(void); -extern int ITc_watchface_complication_provider_setup_is_editing_p(void); -extern int ITc_watchface_complication_provider_data_set_short_text_p(void); -extern int ITc_watchface_complication_provider_data_set_long_text_p(void); -extern int ITc_watchface_complication_provider_data_set_title_p(void); -extern int ITc_watchface_complication_provider_data_set_timestamp_p(void); -extern int ITc_watchface_complication_provider_data_set_image_path_p(void); -extern int ITc_watchface_complication_provider_data_set_ranged_value_p(void); -extern int ITc_watchface_complication_provider_data_set_icon_path_p(void); -extern int ITc_watchface_complication_provider_data_set_extra_data_p(void); -extern int ITc_watchface_complication_provider_event_get_type_p(void); -extern int ITc_watchface_complication_provider_event_get_provider_id_p(void); -extern int ITc_watchface_complication_provider_event_get_complication_type_p(void); -extern int ITc_watchface_complication_provider_event_get_context_p(void); -extern int ITc_watchface_complication_provider_data_set_screen_reader_text_p(void); -extern int ITc_watchface_complication_provider_data_is_valid_p(void); - -extern void ITs_watchface_complication_startup(void); -extern void ITs_watchface_complication_cleanup(void); -extern int ITc_watchface_complication_get_current_provider_id_p(void); -extern int ITc_watchface_complication_get_current_type_p(void); -extern int ITc_watchface_complication_create_destroy_p(void); -extern int ITc_watchface_complication_data_get_type_p(void); -extern int ITc_watchface_complication_data_get_long_text_p(void); -extern int ITc_watchface_complication_data_get_short_text_p(void); -extern int ITc_watchface_complication_data_get_title_p(void); -extern int ITc_watchface_complication_data_get_timestamp_p(void); -extern int ITc_watchface_complication_data_get_image_path_p(void); -extern int ITc_watchface_complication_data_get_ranged_value_p(void); -extern int ITc_watchface_complication_data_get_icon_path_p(void); -extern int ITc_watchface_complication_data_get_extra_data_p(void); -extern int ITc_watchface_complication_allowed_list_create_destroy_p(void); -extern int ITc_watchface_complication_allowed_list_add_delete_p(void); -extern int ITc_watchface_complication_allowed_list_get_nth_p(void); -extern int ITc_watchface_complication_allowed_list_apply_clear_p(void); -extern int ITc_watchface_complication_add_update_remove_updated_cb_p(void); -extern int ITc_watchface_complication_data_get_screen_reader_text_p(void); -extern int ITc_watchface_complication_transfer_event_p(void); - -extern void ITs_watchface_editable_startup(void); -extern void ITs_watchface_editable_cleanup(void); -extern int ITc_watchface_editable_candidates_list_create_add_destroy_p(void); -extern int ITc_watchface_editable_add_complication_p(void); -extern int ITc_watchface_editable_get_nth_data_p(void); -extern int ITc_watchface_editable_add_design_element_p(void); -extern int ITc_watchface_editable_request_edit_p(void); -extern int ITc_watchface_editable_add_remove_edit_ready_cb_p(void); -extern int ITc_watchface_editable_get_current_data_p(void); -extern int ITc_watchface_editable_get_current_data_idx_p(void); -extern int ITc_watchface_editable_get_editable_id_p(void); -extern int ITc_watchface_editable_load_current_data_p(void); -extern int ITc_watchface_editable_set_editable_name_p(void); -extern int ITc_watchface_editable_get_editable_name_p(void); -extern int ITc_watchface_editable_get_highlight_p(void); -extern int ITc_watchface_editable_set_get_geometry_p(void); -extern int ITc_watchface_editable_highlight_set_get_shape_type_p(void); -extern int ITc_watchface_editable_highlight_create_destroy_p(void); - -testcase tc_array[] = { - {"ITc_watchface_complication_provider_add_remove_update_requested_cb_p", ITc_watchface_complication_provider_add_remove_update_requested_cb_p, ITs_watchface_complication_provider_startup, ITs_watchface_complication_provider_cleanup}, - {"ITc_watchface_complication_provider_notify_update_p", ITc_watchface_complication_provider_notify_update_p, ITs_watchface_complication_provider_startup, ITs_watchface_complication_provider_cleanup}, - {"ITc_watchface_complication_provider_setup_reply_to_editor_p", ITc_watchface_complication_provider_setup_reply_to_editor_p, ITs_watchface_complication_provider_startup, ITs_watchface_complication_provider_cleanup}, - {"ITc_watchface_complication_provider_setup_is_editing_p", ITc_watchface_complication_provider_setup_is_editing_p, ITs_watchface_complication_provider_startup, ITs_watchface_complication_provider_cleanup}, - {"ITc_watchface_complication_provider_setup_get_context_p", ITc_watchface_complication_provider_setup_get_context_p, ITs_watchface_complication_provider_startup, ITs_watchface_complication_provider_cleanup}, - {"ITc_watchface_complication_provider_data_set_short_text_p", ITc_watchface_complication_provider_data_set_short_text_p, ITs_watchface_complication_provider_startup, ITs_watchface_complication_provider_cleanup}, - {"ITc_watchface_complication_provider_data_set_long_text_p", ITc_watchface_complication_provider_data_set_long_text_p, ITs_watchface_complication_provider_startup, ITs_watchface_complication_provider_cleanup}, - {"ITc_watchface_complication_provider_data_set_title_p", ITc_watchface_complication_provider_data_set_title_p, ITs_watchface_complication_provider_startup, ITs_watchface_complication_provider_cleanup}, - {"ITc_watchface_complication_provider_data_set_timestamp_p", ITc_watchface_complication_provider_data_set_timestamp_p, ITs_watchface_complication_provider_startup, ITs_watchface_complication_provider_cleanup}, - {"ITc_watchface_complication_provider_data_set_image_path_p", ITc_watchface_complication_provider_data_set_image_path_p, ITs_watchface_complication_provider_startup, ITs_watchface_complication_provider_cleanup}, - {"ITc_watchface_complication_provider_data_set_ranged_value_p", ITc_watchface_complication_provider_data_set_ranged_value_p, ITs_watchface_complication_provider_startup, ITs_watchface_complication_provider_cleanup}, - {"ITc_watchface_complication_provider_data_set_icon_path_p", ITc_watchface_complication_provider_data_set_icon_path_p, ITs_watchface_complication_provider_startup, ITs_watchface_complication_provider_cleanup}, - {"ITc_watchface_complication_provider_data_set_extra_data_p", ITc_watchface_complication_provider_data_set_extra_data_p, ITs_watchface_complication_provider_startup, ITs_watchface_complication_provider_cleanup}, - {"ITc_watchface_complication_provider_event_get_type_p", ITc_watchface_complication_provider_event_get_type_p, ITs_watchface_complication_provider_startup, ITs_watchface_complication_provider_cleanup}, - {"ITc_watchface_complication_provider_event_get_provider_id_p", ITc_watchface_complication_provider_event_get_provider_id_p, ITs_watchface_complication_provider_startup, ITs_watchface_complication_provider_cleanup}, - {"ITc_watchface_complication_provider_event_get_complication_type_p", ITc_watchface_complication_provider_event_get_complication_type_p, ITs_watchface_complication_provider_startup, ITs_watchface_complication_provider_cleanup}, - {"ITc_watchface_complication_provider_event_get_context_p", ITc_watchface_complication_provider_event_get_context_p, ITs_watchface_complication_provider_startup, ITs_watchface_complication_provider_cleanup}, - {"ITc_watchface_complication_provider_data_set_screen_reader_text_p", ITc_watchface_complication_provider_data_set_screen_reader_text_p, ITs_watchface_complication_provider_startup, ITs_watchface_complication_provider_cleanup}, - {"ITc_watchface_complication_provider_data_is_valid_p", ITc_watchface_complication_provider_data_is_valid_p, ITs_watchface_complication_provider_startup, ITs_watchface_complication_provider_cleanup}, - - {"ITc_watchface_complication_get_current_provider_id_p", ITc_watchface_complication_get_current_provider_id_p, ITs_watchface_complication_startup, ITs_watchface_complication_cleanup}, - {"ITc_watchface_complication_get_current_type_p", ITc_watchface_complication_get_current_type_p, ITs_watchface_complication_startup, ITs_watchface_complication_cleanup}, - {"ITc_watchface_complication_create_destroy_p", ITc_watchface_complication_create_destroy_p, ITs_watchface_complication_startup, ITs_watchface_complication_cleanup}, - {"ITc_watchface_complication_data_get_type_p", ITc_watchface_complication_data_get_type_p, ITs_watchface_complication_startup, ITs_watchface_complication_cleanup}, - {"ITc_watchface_complication_data_get_long_text_p", ITc_watchface_complication_data_get_long_text_p, ITs_watchface_complication_startup, ITs_watchface_complication_cleanup}, - {"ITc_watchface_complication_data_get_short_text_p", ITc_watchface_complication_data_get_short_text_p, ITs_watchface_complication_startup, ITs_watchface_complication_cleanup}, - {"ITc_watchface_complication_data_get_timestamp_p", ITc_watchface_complication_data_get_timestamp_p, ITs_watchface_complication_startup, ITs_watchface_complication_cleanup}, - {"ITc_watchface_complication_data_get_image_path_p", ITc_watchface_complication_data_get_image_path_p, ITs_watchface_complication_startup, ITs_watchface_complication_cleanup}, - {"ITc_watchface_complication_data_get_ranged_value_p", ITc_watchface_complication_data_get_ranged_value_p, ITs_watchface_complication_startup, ITs_watchface_complication_cleanup}, - {"ITc_watchface_complication_data_get_icon_path_p", ITc_watchface_complication_data_get_icon_path_p, ITs_watchface_complication_startup, ITs_watchface_complication_cleanup}, - {"ITc_watchface_complication_data_get_extra_data_p", ITc_watchface_complication_data_get_extra_data_p, ITs_watchface_complication_startup, ITs_watchface_complication_cleanup}, - {"ITc_watchface_complication_allowed_list_create_destroy_p", ITc_watchface_complication_allowed_list_create_destroy_p, ITs_watchface_complication_startup, ITs_watchface_complication_cleanup}, - {"ITc_watchface_complication_allowed_list_add_delete_p", ITc_watchface_complication_allowed_list_add_delete_p, ITs_watchface_complication_startup, ITs_watchface_complication_cleanup}, - {"ITc_watchface_complication_allowed_list_get_nth_p", ITc_watchface_complication_allowed_list_get_nth_p, ITs_watchface_complication_startup, ITs_watchface_complication_cleanup}, - {"ITc_watchface_complication_allowed_list_apply_clear_p", ITc_watchface_complication_allowed_list_apply_clear_p, ITs_watchface_complication_startup, ITs_watchface_complication_cleanup}, - {"ITc_watchface_complication_data_get_title_p", ITc_watchface_complication_data_get_title_p, ITs_watchface_complication_startup, ITs_watchface_complication_cleanup}, - {"ITc_watchface_complication_add_update_remove_updated_cb_p", ITc_watchface_complication_add_update_remove_updated_cb_p, ITs_watchface_complication_startup, ITs_watchface_complication_cleanup}, - {"ITc_watchface_complication_data_get_screen_reader_text_p", ITc_watchface_complication_data_get_screen_reader_text_p, ITs_watchface_complication_startup, ITs_watchface_complication_cleanup}, - {"ITc_watchface_complication_transfer_event_p", ITc_watchface_complication_transfer_event_p, ITs_watchface_complication_startup, ITs_watchface_complication_cleanup}, - - {"ITc_watchface_editable_candidates_list_create_add_destroy_p", ITc_watchface_editable_candidates_list_create_add_destroy_p, ITs_watchface_editable_startup, ITs_watchface_editable_cleanup}, - {"ITc_watchface_editable_add_complication_p", ITc_watchface_editable_add_complication_p, ITs_watchface_editable_startup, ITs_watchface_editable_cleanup}, - {"ITc_watchface_editable_get_nth_data_p", ITc_watchface_editable_get_nth_data_p, ITs_watchface_editable_startup, ITs_watchface_editable_cleanup}, - {"ITc_watchface_editable_add_design_element_p", ITc_watchface_editable_add_design_element_p, ITs_watchface_editable_startup, ITs_watchface_editable_cleanup}, - {"ITc_watchface_editable_request_edit_p", ITc_watchface_editable_request_edit_p, ITs_watchface_editable_startup, ITs_watchface_editable_cleanup}, - {"ITc_watchface_editable_add_remove_edit_ready_cb_p", ITc_watchface_editable_add_remove_edit_ready_cb_p, ITs_watchface_editable_startup, ITs_watchface_editable_cleanup}, - {"ITc_watchface_editable_get_current_data_p", ITc_watchface_editable_get_current_data_p, ITs_watchface_editable_startup, ITs_watchface_editable_cleanup}, - {"ITc_watchface_editable_get_current_data_idx_p", ITc_watchface_editable_get_current_data_idx_p, ITs_watchface_editable_startup, ITs_watchface_editable_cleanup}, - {"ITc_watchface_editable_get_editable_id_p", ITc_watchface_editable_get_editable_id_p, ITs_watchface_editable_startup, ITs_watchface_editable_cleanup}, - {"ITc_watchface_editable_load_current_data_p", ITc_watchface_editable_load_current_data_p, ITs_watchface_editable_startup, ITs_watchface_editable_cleanup}, - {"ITc_watchface_editable_set_editable_name_p", ITc_watchface_editable_set_editable_name_p, ITs_watchface_editable_startup, ITs_watchface_editable_cleanup}, - {"ITc_watchface_editable_get_editable_name_p", ITc_watchface_editable_get_editable_name_p, ITs_watchface_editable_startup, ITs_watchface_editable_cleanup}, - {"ITc_watchface_editable_get_highlight_p", ITc_watchface_editable_get_highlight_p, ITs_watchface_editable_startup, ITs_watchface_editable_cleanup}, - {"ITc_watchface_editable_set_get_geometry_p", ITc_watchface_editable_set_get_geometry_p, ITs_watchface_editable_startup, ITs_watchface_editable_cleanup}, - {"ITc_watchface_editable_highlight_set_get_shape_type_p", ITc_watchface_editable_highlight_set_get_shape_type_p, ITs_watchface_editable_startup, ITs_watchface_editable_cleanup}, - {"ITc_watchface_editable_highlight_create_destroy_p", ITc_watchface_editable_highlight_create_destroy_p, ITs_watchface_editable_startup, ITs_watchface_editable_cleanup}, - - {NULL, NULL} -}; - -#endif // __TCT_WATCHFACE-NATIVE_H__ diff --git a/tct_unsupported.txt b/tct_unsupported.txt index a2f125f57..69a3bdc1a 100755 --- a/tct_unsupported.txt +++ b/tct_unsupported.txt @@ -50,10 +50,10 @@ mobile:armv7l:itc:cbhm; mobile:aarch64:itc:cbhm; mobile:x86:itc:cbhm; mobile:x86_64:itc:cbhm; -mobile:armv7l:itc:watchface; -mobile:aarch64:itc:watchface; -mobile:x86:itc:watchface; -mobile:x86_64:itc:watchface; +mobile:armv7l:itc:watchface-complication; +mobile:aarch64:itc:watchface-complication; +mobile:x86:itc:watchface-complication; +mobile:x86_64:itc:watchface-complication; ## ctc ## @@ -234,10 +234,10 @@ tizeniot:armv7l:itc:radio; tizeniot:aarch64:itc:radio; tizeniot:x86:itc:radio; tizeniot:x86_64:itc:radio; -tizeniot:armv7l:itc:watchface; -tizeniot:aarch64:itc:watchface; -tizeniot:x86:itc:watchface; -tizeniot:x86_64:itc:watchface; +tizeniot:armv7l:itc:watchface-complication; +tizeniot:aarch64:itc:watchface-complication; +tizeniot:x86:itc:watchface-complication; +tizeniot:x86_64:itc:watchface-complication; ## ctc ## tizeniot:armv7l:ctc:platform-permission;