--- /dev/null
+%define MODULE_NAME cbhm
+%define MODULE_LIBNAME cbhm
+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(glib-2.0)
+BuildRequires: cmake
+BuildRequires: pkgconfig(bundle)
+BuildRequires: pkgconfig(elementary)
+BuildRequires: pkgconfig(dlog)
+BuildRequires: pkgconfig(capi-system-info)
+
+%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_COMMON_IOT:1}0
+ cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="itc" -DDEVICE_BUILD_TYPE="common_iot" -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_COMMON_IOT:1}0
+ cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="itc" -DDEVICE_BUILD_TYPE="common_iot" -DASANBUILD="false" -DCMAKE_INSTALL_PREFIX=%{_prefix}
+ %endif
+%endif
+
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+%make_install
+mkdir -p %{buildroot}/usr/share/license
+cp LICENSE %{buildroot}/usr/share/license/%{name}
+
+mkdir -p %{buildroot}/usr/share/packages/
+cp packaging/itc/native-%{MODULE_NAME}-itc.xml %{buildroot}/usr/share/packages/
+mkdir -p %{buildroot}%{APP_PATH}%{name}/bin
+%post
+
+%postun
+
+
+%files
+%{APP_PATH}%{name}/*
+/usr/share/packages/native-%{MODULE_NAME}-itc.xml
+/usr/share/license/%{name}
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" package="native-cbhm-itc" version="0.1.0" api-version="3.0">
+ <label>NativeCbhmTest</label>
+ <author email="mymail@tizentest.com" href="www.tizentest.com">test</author>
+ <description>Native API test Application</description>
+ <ui-application appid="native.cbhm-itc" exec="/usr/apps/native-cbhm-itc/bin/tct-cbhm-native" nodisplay="false" multiple="false" type="capp" taskmanage="true">
+ <background-category value="background-network"/>
+ <background-category value="download"/>
+ <background-category value="iot-communication"/>
+ <background-category value="location"/>
+ <background-category value="media"/>
+ <background-category value="sensor"/>
+ </ui-application>
+</manifest>
--- /dev/null
+SET(PKG_NAME "cbhm")
+
+SET(EXEC_NAME "tct-${PKG_NAME}-native")
+SET(RPM_NAME "native-${PKG_NAME}-itc")
+
+SET(CAPI_LIB "cbhm")
+SET(TC_SOURCES
+ ITs-cbhm-common.c
+ ITs-cbhm.c
+)
+
+PKG_CHECK_MODULES(${CAPI_LIB} REQUIRED
+ ${CAPI_LIB}
+ capi-appfw-application
+ glib-2.0
+ bundle
+ capi-system-info
+ dlog
+ elementary
+)
+
+INCLUDE_DIRECTORIES(
+ ${${CAPI_LIB}_INCLUDE_DIRS}
+)
+
+ADD_EXECUTABLE(${EXEC_NAME} ${EXEC_NAME}.c ${TC_SOURCES} ${COMMON_FILE})
+TARGET_LINK_LIBRARIES(${EXEC_NAME}
+ ${${CAPI_LIB}_LIBRARIES}
+ bundle
+)
+
+INSTALL(PROGRAMS ${EXEC_NAME}
+ DESTINATION ${BIN_DIR}/${RPM_NAME}/bin
+)
+
+IF( DEFINED ASAN )
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -Wall -pie -g -fsanitize=address -fsanitize-recover=address -U_FORTIFY_SOURCE -fno-omit-frame-pointer")
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib -Wl,-fsanitize=address")
+ELSE()
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -g -fPIE -Wall")
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib -pie")
+ENDIF()
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#include "ITs-cbhm-common.h"
+
+/** @addtogroup itc-cbhm
+* @ingroup itc
+* @{
+*/
+
+/**
+* @function CbhmGetError
+* @description Maps error enums to string values
+* @parameter nRet : error code returned
+* @return error string
+*/
+char *CbhmGetError(int nRet)
+{
+ char *szErrorVal = NULL;
+ switch ( nRet )
+ {
+ case CBHM_ERROR_NONE: szErrorVal = "CBHM_ERROR_NONE"; break;
+ case CBHM_ERROR_OUT_OF_MEMORY: szErrorVal = "CBHM_ERROR_OUT_OF_MEMORY"; break;
+ case CBHM_ERROR_NOT_SUPPORTED: szErrorVal = "CBHM_ERROR_NOT_SUPPORTED"; break;
+ case CBHM_ERROR_INVALID_PARAMETER: szErrorVal = "CBHM_ERROR_INVALID_PARAMETER"; break;
+ case CBHM_ERROR_NO_DATA: szErrorVal = "CBHM_ERROR_NO_DATA"; break;
+ case CBHM_ERROR_CONNECTION_REFUSED: szErrorVal = "CBHM_ERROR_CONNECTION_REFUSED"; break;
+ //case CBHM_ERROR_ALREADY_IN_USE: szErrorVal = "CBHM_ERROR_ALREADY_IN_USE"; break; //Giving undeclared build error
+ default: szErrorVal = "Unknown Error"; break;
+ }
+
+ return szErrorVal;
+}
+
+/**
+ * @function Timeout
+ * @description Called if some callback is not invoked for a particular timeout
+ * @parameter gpointer data
+ * @return gboolean
+ */
+gboolean Timeout(gpointer data)
+{
+ GMainLoop *pMainLoop = NULL;
+ pMainLoop = (GMainLoop *)data;
+ if ( pMainLoop != NULL )
+ {
+ g_main_loop_quit(pMainLoop);
+ }
+ return false;
+}
+
+/** @} */
\ No newline at end of file
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#ifndef _ITS_CBHM_COMMON_H_
+#define _ITS_CBHM_COMMON_H_
+
+//Add test package related includes here
+#include "tct_common.h"
+#include <cbhm.h>
+#include <glib.h>
+#include <Elementary.h>
+
+/** @addtogroup itc-%{MODULE_NAME}
+* @ingroup itc
+* @{
+*/
+
+#define API_NAMESPACE "CBHM_ITC"
+#define TIMEOUT_CB 20000
+bool g_bCbhmInit;
+GMainLoop *g_mainloop;
+
+#define START_TEST {\
+ FPRINTF("[Line : %d] Starting test : %s\\n", __LINE__ ,__FUNCTION__);\
+ if ( !g_bCbhmInit )\
+ {\
+ FPRINTF("[Line : %d] [API_NAMESPACE] Precondition of cbhm failed\\n", __LINE__);\
+ return 1;\
+ }\
+}
+
+#define RUN_POLLING_LOOP {\
+ g_mainloop = g_main_loop_new(NULL, false);\
+ nTimeoutId = g_timeout_add(TIMEOUT_CB, Timeout, g_mainloop);\
+ g_main_loop_run(g_mainloop);\
+ g_source_remove(nTimeoutId);\
+ g_mainloop = NULL;\
+}
+
+char *CbhmGetError(int nRet);
+gboolean Timeout(gpointer data);
+
+/** @} */
+#endif //_ITS_CBHM_COMMON_H_
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#include "ITs-cbhm-common.h"
+
+//& set: Cbhm
+
+/** @addtogroup itc-cbhm
+* @ingroup itc
+* @{
+*/
+
+static cbhm_h g_CbhmHandle = NULL;
+static bool g_bCallBackCheck = false;
+static bool g_bCallBackDataCheck = false;
+static char *g_pszData = NULL;
+
+static int CbhmSelectionDataCb(cbhm_h cbhm_handle, const char *buf, size_t len, void *user_data)
+{
+ g_bCallBackCheck = true;
+ FPRINTF("[Line : %d] [%s] Inside callcack function CbhmSelectionDataCb \\n", __LINE__, API_NAMESPACE);
+
+ if(buf)
+ {
+ strncpy(g_pszData, buf, len);
+ g_bCallBackDataCheck = true;
+ }
+ else
+ {
+ FPRINTF("[Line : %d] [%s] Invalid callback data \\n", __LINE__, API_NAMESPACE);
+ }
+
+ if ( g_mainloop )
+ {
+ g_main_loop_quit(g_mainloop);
+ }
+ return CBHM_ERROR_NONE;
+}
+
+static int CbhmSelectionCb(cbhm_h cbhm_handle, void *user_data)
+{
+ FPRINTF("[Line : %d] [%s] Inside callcack function CbhmSelectionCb \\n", __LINE__, API_NAMESPACE);
+ return CBHM_ERROR_NONE;
+}
+
+/**
+ * @function ITs_cbhm_startup
+ * @description Called before each test
+ * @parameter NA
+ * @return NA
+ */
+void ITs_cbhm_startup(void)
+{
+ struct stat stBuff;
+ if ( stat(ERR_LOG, &stBuff) == 0 )
+ {
+ remove(ERR_LOG);
+ }
+
+ elm_init(0, NULL);
+ g_bCbhmInit = false;
+
+ int nRet = cbhm_open_service(&g_CbhmHandle);
+ if ( nRet != CBHM_ERROR_NONE )
+ {
+ FPRINTF("[Line : %d] [%s] cbhm_open_service failed in startup, error = %s\\n", __LINE__, API_NAMESPACE, CbhmGetError(nRet));
+ return;
+ }
+ if ( g_CbhmHandle == NULL )
+ {
+ FPRINTF("[Line : %d] [%s] cbhm handle returned is NULL\\n", __LINE__, API_NAMESPACE);
+ return;
+ }
+
+ g_bCbhmInit = true;
+ return;
+}
+
+
+/**
+ * @function ITs_cbhm_cleanup
+ * @description Called after each test
+ * @parameter NA
+ * @return NA
+ */
+void ITs_cbhm_cleanup(void)
+{
+ if(g_CbhmHandle)
+ {
+ int nRet = cbhm_close_service(g_CbhmHandle);
+ if ( nRet != CBHM_ERROR_NONE )
+ {
+ FPRINTF("[Line : %d] [%s] cbhm_close_service failed in cleanup, error = %s\\n", __LINE__, API_NAMESPACE, CbhmGetError(nRet));
+ }
+ }
+ g_CbhmHandle = NULL;
+
+ return;
+}
+
+/** @addtogroup itc-cbhm-testcases
+* @brief Integration testcases for module cbhm
+* @ingroup itc-cbhm
+* @{
+*/
+
+//& type: auto
+//& purpose: Initializes and close the clipboard handle to use clipboard
+/**
+* @testcase ITc_cbhm_open_close_service_p
+* @since_tizen 3.0
+* @author SRID(a.pandia1)
+* @reviewer SRID(nibha.sharma)
+* @type auto
+* @description To create and remove a badge
+* @scenario Initializes and close the clipboard handle to use clipboard
+* Initializes the clipboard handle to use clipboard\n
+* Closes the clipboard handle\n
+* @apicovered cbhm_open_service, cbhm_close_service
+* @passcase If cbhm_open_service, cbhm_close_service returns success
+* @failcase If cbhm_open_service, cbhm_close_service returns false
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_cbhm_open_close_service_p(void)
+{
+ START_TEST;
+
+ cbhm_h h_Cbhm = NULL;
+
+ int nRet = cbhm_open_service(&h_Cbhm);
+ PRINT_RESULT(CBHM_ERROR_NONE, nRet, "cbhm_open_service", CbhmGetError(nRet));
+ CHECK_HANDLE(h_Cbhm, "cbhm_open_service")
+
+ nRet = cbhm_close_service(h_Cbhm);
+ PRINT_RESULT(CBHM_ERROR_NONE, nRet, "cbhm_close_service", CbhmGetError(nRet));
+
+ return 0;
+}
+
+//& type: auto
+//& purpose: Sets and gets the clipboard selection type
+/**
+* @testcase ITc_cbhm_selection_type_set_get_p
+* @since_tizen 3.0
+* @author SRID(a.pandia1)
+* @reviewer SRID(nibha.sharma)
+* @type auto
+* @description Sets and gets the clipboard selection type
+* @scenario Sets the clipboard selection type
+* Gets the clipboard selection type
+* @apicovered cbhm_selection_type_set, cbhm_selection_type_get
+* @passcase If cbhm_selection_type_set, cbhm_selection_type_get returns success
+* @failcase If cbhm_selection_type_set, cbhm_selection_type_get returns false
+* @precondition Initializes the clipboard handle to use clipboard
+* @postcondition Close the clipboard handle
+*/
+int ITc_cbhm_selection_type_set_get_p(void)
+{
+ START_TEST;
+
+ int nRet = -1, nEnumCount = 0, nIterator = 0;
+ cbhm_sel_type_e eGetSelType;
+
+ cbhm_sel_type_e arrSelType[] = {
+ //CBHM_SEL_TYPE_TARGETS, /** For matching every possible atom */
+ CBHM_SEL_TYPE_NONE, /** Content is from outside of Elementary */
+ CBHM_SEL_TYPE_TEXT, /** Plain unformatted text: Used for things that don't want rich markup */
+ CBHM_SEL_TYPE_MARKUP, /** Edje textblock markup, including inline images */
+ CBHM_SEL_TYPE_IMAGE, /** Images */
+ //CBHM_SEL_TYPE_VCARD, /** Vcards */
+ CBHM_SEL_TYPE_HTML /** Raw HTML-like data (eg. webkit) */
+ };
+
+ nEnumCount = sizeof(arrSelType) / sizeof(arrSelType[0]);
+
+ for ( nIterator = 0; nIterator < nEnumCount; nIterator++ )
+ {
+ nRet = cbhm_selection_type_set(g_CbhmHandle, arrSelType[nIterator]);
+ PRINT_RESULT(CBHM_ERROR_NONE, nRet, "cbhm_selection_type_set", CbhmGetError(nRet));
+
+ nRet = cbhm_selection_type_get(g_CbhmHandle, &eGetSelType);
+ PRINT_RESULT(CBHM_ERROR_NONE, nRet, "cbhm_selection_type_get", CbhmGetError(nRet));
+
+ if(eGetSelType != arrSelType[nIterator])
+ {
+ FPRINTF("[Line : %d] [%s] cbhm_sel_type_e set get values mismatch\\n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
+//& type: auto
+//& purpose: Shows and hides the clipboard
+/**
+* @testcase ITc_cbhm_show_hide_p
+* @since_tizen 3.0
+* @author SRID(a.pandia1)
+* @reviewer SRID(nibha.sharma)
+* @type auto
+* @description Shows and hides the clipboard
+* @scenario Shows the clipboard
+* Hides the clipboard
+* @apicovered cbhm_show, cbhm_hide
+* @passcase If cbhm_show, cbhm_hide returns success
+* @failcase If cbhm_show, cbhm_hide returns false
+* @precondition Initializes the clipboard handle to use clipboard
+* @postcondition Close the clipboard handle
+*/
+int ITc_cbhm_show_hide_p(void)
+{
+ START_TEST;
+
+ int nRet = cbhm_selection_type_set(g_CbhmHandle, CBHM_SEL_TYPE_TEXT);
+ PRINT_RESULT(CBHM_ERROR_NONE, nRet, "cbhm_selection_type_set", CbhmGetError(nRet));
+
+ nRet = cbhm_show(g_CbhmHandle);
+ PRINT_RESULT(CBHM_ERROR_NONE, nRet, "cbhm_show", CbhmGetError(nRet));
+
+ nRet = cbhm_hide(g_CbhmHandle);
+ PRINT_RESULT(CBHM_ERROR_NONE, nRet, "cbhm_hide", CbhmGetError(nRet));
+
+ return 0;
+}
+
+//& type: auto
+//& purpose: Shows and hides the clipboard
+/**
+* @testcase ITc_cbhm_selection_set_get_p
+* @since_tizen 3.0
+* @author SRID(a.pandia1)
+* @reviewer SRID(nibha.sharma)
+* @type auto
+* @description Shows and hides the clipboard
+* @scenario Shows the clipboard
+* Hides the clipboard
+* @apicovered cbhm_selection_type_set, cbhm_selection_set, cbhm_selection_get
+* @passcase If cbhm_selection_set, cbhm_selection_get returns success
+* @failcase If cbhm_selection_set, cbhm_selection_get returns false
+* @precondition Initializes the clipboard handle to use clipboard
+* @postcondition Close the clipboard handle
+*/
+int ITc_cbhm_selection_set_get_p(void)
+{
+ START_TEST;
+ int nRet = -1;
+ char *pszData = "Test Data CBHM ITC";
+ int nTimeoutId = 0;
+
+ cbhm_h h_Cbhm = NULL;
+ nRet = cbhm_open_service(&h_Cbhm);
+ PRINT_RESULT(CBHM_ERROR_NONE, nRet, "cbhm_open_service", CbhmGetError(nRet));
+ CHECK_HANDLE(h_Cbhm, "cbhm_open_service");
+
+ g_bCallBackCheck = false;
+ g_bCallBackDataCheck = false;
+
+ nRet = cbhm_selection_type_set(h_Cbhm, CBHM_SEL_TYPE_TEXT);
+ PRINT_RESULT_CLEANUP(CBHM_ERROR_NONE, nRet, "cbhm_selection_type_set", CbhmGetError(nRet), cbhm_close_service(h_Cbhm));
+
+ nRet = cbhm_selection_set(h_Cbhm, CBHM_SEL_TYPE_TEXT, pszData, strlen(pszData));
+ PRINT_RESULT_CLEANUP(CBHM_ERROR_NONE, nRet, "cbhm_selection_set", CbhmGetError(nRet), cbhm_close_service(h_Cbhm));
+
+ sleep(2);
+ nRet = cbhm_selection_get(h_Cbhm, CBHM_SEL_TYPE_TEXT, CbhmSelectionDataCb, NULL);
+ PRINT_RESULT_CLEANUP(CBHM_ERROR_NONE, nRet, "cbhm_selection_get", CbhmGetError(nRet), cbhm_close_service(h_Cbhm));
+
+ RUN_POLLING_LOOP;
+ if (!g_bCallBackCheck)
+ {
+ FPRINTF("[Line : %d][%s] CbhmSelectionDataCb callback not hit\\n", __LINE__, API_NAMESPACE);
+ cbhm_close_service(h_Cbhm);
+ return 1;
+ }
+ if (!g_bCallBackDataCheck)
+ {
+ cbhm_close_service(h_Cbhm);
+ return 1;
+ }
+ if(strcmp(pszData, g_pszData) != 0)
+ {
+ FPRINTF("[Line : %d] [%s] set get data values mismatch\\n", __LINE__, API_NAMESPACE);
+ cbhm_close_service(h_Cbhm);
+ return 1;
+ }
+
+ nRet = cbhm_close_service(h_Cbhm);
+ PRINT_RESULT_NORETURN(CBHM_ERROR_NONE, nRet, "cbhm_close_service", CbhmGetError(nRet));
+}
+
+//& type: auto
+//& purpose: Gets the count of clipboard items
+/**
+* @testcase ITc_cbhm_item_count_get_p
+* @since_tizen 3.0
+* @author SRID(a.pandia1)
+* @reviewer SRID(nibha.sharma)
+* @type auto
+* @description Gets the count of clipboard items
+* @scenario Gets the count of clipboard items
+* @apicovered cbhm_selection_type_set, cbhm_item_count_get
+* @passcase If cbhm_item_count_get returns success
+* @failcase If cbhm_item_count_get returns false
+* @precondition Initializes the clipboard handle to use clipboard
+* @postcondition Close the clipboard handle
+*/
+int ITc_cbhm_item_count_get_p(void)
+{
+ START_TEST;
+ char *pszData = "Test Data CBHM ITC";
+
+ int nRet = cbhm_selection_set(g_CbhmHandle, CBHM_SEL_TYPE_TEXT, pszData, strlen(pszData));
+ PRINT_RESULT(CBHM_ERROR_NONE, nRet, "cbhm_selection_type_set", CbhmGetError(nRet));
+
+ nRet = -1;
+ nRet = cbhm_item_count_get(g_CbhmHandle);
+ FPRINTF("[Line : %d][%s] Item count from recieved from cbhm_item_count_get = %d\\n", __LINE__, API_NAMESPACE, nRet);
+ if(nRet < 0 || nRet == CBHM_ERROR_INVALID_PARAMETER)
+ {
+ FPRINTF("[Line : %d][%s] Invalid return value of API cbhm_item_count_get = %s\\n", __LINE__, API_NAMESPACE, CbhmGetError(nRet));
+ return 1;
+ }
+
+ return 0;
+}
+
+//& type: auto
+//& purpose: Adds the event callback for handling selection of clipboard item
+/**
+* @testcase ITc_cbhm_item_selected_callback_add_p
+* @since_tizen 3.0
+* @author SRID(a.pandia1)
+* @reviewer SRID(nibha.sharma)
+* @type auto
+* @description Adds the event callback for handling selection of clipboard item
+* @scenario Adds the event callback for handling selection of clipboard item
+* @apicovered cbhm_item_selected_callback_add
+* @passcase If cbhm_item_selected_callback_add returns success
+* @failcase If cbhm_item_selected_callback_add returns false
+* @precondition Initializes the clipboard handle to use clipboard
+* @postcondition Close the clipboard handle
+*/
+int ITc_cbhm_item_selected_callback_add_p(void)
+{
+ START_TEST;
+
+ int nRet = cbhm_item_selected_callback_add(g_CbhmHandle, CbhmSelectionCb, NULL);
+ PRINT_RESULT(CBHM_ERROR_NONE, nRet, "cbhm_item_selected_callback_add", CbhmGetError(nRet));
+
+ return 0;
+}
+
+/** @} */
+/** @} */
\ No newline at end of file
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#include "tct_common.h"
+
+#ifdef MOBILE //Starts MOBILE
+#include "tct-cbhm-native_mobile.h"
+#endif //MOBILE //End MOBILE
+
+#ifdef WEARABLE //Starts WEARABLE
+#include "tct-cbhm-native_wearable.h"
+#endif //WEARABLE //End WEARABLE
+
+#ifdef TV //Starts TV
+#include "tct-cbhm-native_tv.h"
+#endif //TV //End TV
+
+#ifdef COMMON_IOT //Starts COMMON_IOT
+#include "tct-cbhm-native_common_iot.h"
+#endif //COMMON_IOT //End COMMON_IOT
+
+#include <stdio.h>
+#include <string.h>
+#include <malloc.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+#include <glib.h>
+#include <stdbool.h>
+#include <app.h>
+#include <dlog.h>
+
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <errno.h>
+
+#include <Elementary.h>
+
+typedef struct appdata {
+ Evas_Object *win;
+ Evas_Object *conform;
+ Evas_Object *label;
+} appdata_s;
+
+static bool app_create(void *data)
+{
+ return true;
+}
+
+static void app_control(app_control_h app_control, void *data)
+{
+ char* pszGetTCName = NULL;
+ int i=0, result=0, nRet=0;
+ nRet = app_control_get_extra_data(app_control, "testcase_name", &pszGetTCName);
+ if(nRet != APP_CONTROL_ERROR_NONE)
+ {
+ dlog_print(DLOG_ERROR, "NativeTCT", "[%s:%d] app_control_get_extra_data returns error = %d", __FUNCTION__, __LINE__, nRet);
+ PRINT_UTC_LOG("\\n[%s][Line : %d]Unable to fetch test case name: app_control_get_extra_data API call fails\\n", __FILE__, __LINE__);
+ PRINT_TC_RESULT("%d",1);
+ FREE_MEMORY_TC(pszGetTCName);
+ return;
+ }
+
+ dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Executing TC Name = %s", __FUNCTION__, __LINE__, pszGetTCName);
+ for ( i = 0; tc_array[i].name; i++ )
+ {
+ if ( 0 == strncmp(pszGetTCName, tc_array[i].name, strlen(pszGetTCName)) )
+ {
+ if ( tc_array[i].startup )
+ {
+ dlog_print(DLOG_INFO, "NativeTCT", "%s : Start up", pszGetTCName);
+ tc_array[i].startup();
+ }
+
+ dlog_print(DLOG_INFO, "NativeTCT", "%s : Body", pszGetTCName);
+ result = tc_array[i].function();
+ dlog_print(DLOG_INFO, "NativeTCT", "%s returns value = %d", pszGetTCName, result);
+
+ if ( tc_array[i].cleanup )
+ {
+ dlog_print(DLOG_INFO, "NativeTCT", "%s : Clean up", pszGetTCName);
+ tc_array[i].cleanup();
+ }
+
+ PRINT_TC_RESULT("%d",result);
+ FREE_MEMORY_TC(pszGetTCName);
+ return;
+ }
+ }
+
+ dlog_print(DLOG_ERROR, "NativeTCT", "[%s:%d] Unable to execute %s : Unknown Test Case Name", __FUNCTION__, __LINE__, pszGetTCName);
+ PRINT_UTC_LOG("\\n[%s][Line : %d]Unable to execute %s : Unknown Test Case Name\\n", __FILE__, __LINE__, pszGetTCName);
+ PRINT_TC_RESULT("%d",1);
+ FREE_MEMORY_TC(pszGetTCName);
+ return;
+}
+
+static void app_terminate(void *data)
+{
+ dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Application Package is now Terminating", __FUNCTION__, __LINE__);
+}
+
+int main(int argc, char *argv[])
+{
+ int ret = 0;
+ appdata_s ad = {0,};
+
+ ui_app_lifecycle_callback_s event_callback = {0,};
+ event_callback.create = app_create;
+ event_callback.terminate = app_terminate;
+ event_callback.app_control = app_control;
+
+ //setting gcda file location for coverage
+ setenv("GCOV_PREFIX","/tmp",1);
+ dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Coverage *.gcda File location set to /tmp/home/abuild/rpmbuild/BUILD/ ", __FUNCTION__, __LINE__);
+
+ dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Application Main Function is Invoked", __FUNCTION__, __LINE__);
+ ret = ui_app_main(argc, argv, &event_callback, &ad);
+ if (ret != APP_ERROR_NONE)
+ {
+ dlog_print(DLOG_ERROR, "NativeTCT", "Application ui_app_main call gets failed. err = %d", ret);
+ PRINT_UTC_LOG("\\n[%s][Line : %d]Application ui_app_main call gets failed. err = %d\\n", __FILE__, __LINE__, ret);
+ PRINT_TC_RESULT("%d",1);
+ return ret;
+ }
+
+ dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Application Package is Terminated", __FUNCTION__, __LINE__);
+ return ret;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#ifndef __TCT_CBHM_NATIVE_H__
+#define __TCT_CBHM_NATIVE_H__
+
+#include "testcase.h"
+#include "tct_common.h"
+
+extern void ITs_cbhm_startup(void);
+extern void ITs_cbhm_cleanup(void);
+
+extern int ITc_cbhm_open_close_service_p(void);
+extern int ITc_cbhm_selection_type_set_get_p(void);
+extern int ITc_cbhm_show_hide_p(void);
+extern int ITc_cbhm_selection_set_get_p(void);
+extern int ITc_cbhm_item_count_get_p(void);
+extern int ITc_cbhm_item_selected_callback_add_p(void);
+
+testcase tc_array[] = {
+ {"ITc_cbhm_open_close_service_p", ITc_cbhm_open_close_service_p, ITs_cbhm_startup, ITs_cbhm_cleanup},
+ {"ITc_cbhm_selection_type_set_get_p", ITc_cbhm_selection_type_set_get_p, ITs_cbhm_startup, ITs_cbhm_cleanup},
+ {"ITc_cbhm_show_hide_p", ITc_cbhm_show_hide_p, ITs_cbhm_startup, ITs_cbhm_cleanup},
+ {"ITc_cbhm_selection_set_get_p", ITc_cbhm_selection_set_get_p, ITs_cbhm_startup, ITs_cbhm_cleanup},
+ {"ITc_cbhm_item_count_get_p", ITc_cbhm_item_count_get_p, ITs_cbhm_startup, ITs_cbhm_cleanup},
+ {"ITc_cbhm_item_selected_callback_add_p", ITc_cbhm_item_selected_callback_add_p, ITs_cbhm_startup, ITs_cbhm_cleanup},
+ {NULL, NULL}
+};
+
+#endif // __TCT_CBHM_NATIVE_H__