From: MOHIT MIGLANI Date: Fri, 10 Jul 2020 07:40:17 +0000 (+0530) Subject: [ITC][notification][ACR-1504][Updated reporter api test cases, deleted manager api... X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=342fc20344f004bbf48224dd2ca16fe18d04c37e;p=test%2Ftct%2Fnative%2Fapi.git [ITC][notification][ACR-1504][Updated reporter api test cases, deleted manager api test cases and refactored code] Change-Id: I39478b7543a44d8af0b03eb4c389930f3f966c74 Signed-off-by: MOHIT MIGLANI --- diff --git a/src/itc/notification/CMakeLists.txt b/src/itc/notification/CMakeLists.txt index dd3fd4608..c7609ab06 100755 --- a/src/itc/notification/CMakeLists.txt +++ b/src/itc/notification/CMakeLists.txt @@ -7,7 +7,22 @@ SET(CAPI_LIB "notification gobject-2.0") SET(TC_SOURCES ITs-notification-common.c ITs-notification.c - ITs-notification-ex.c + ITs-notification-ex-item.c + ITs-notification-ex-reporter.c + ITs-notification-ex-action_app_control.c + ITs-notification-ex-button.c + ITs-notification-ex-chat-message.c + ITs-notification-ex-checkbox.c + ITs-notification-ex-entry.c + ITs-notification-ex-group.c + ITs-notification-ex-image.c + ITs-notification-ex-input-selector.c + ITs-notification-ex-multi-language.c + ITs-notification-ex-progress.c + ITs-notification-ex-text.c + ITs-notification-ex-time.c + ITs-notification-ex-visibility-action.c + ITs-notification-ex-event_info.c ) PKG_CHECK_MODULES(${CAPI_LIB} REQUIRED diff --git a/src/itc/notification/ITs-notification-common.c b/src/itc/notification/ITs-notification-common.c index 2cccf763a..4b750a882 100755 --- a/src/itc/notification/ITs-notification-common.c +++ b/src/itc/notification/ITs-notification-common.c @@ -16,10 +16,20 @@ #include "ITs-notification-common.h" -/** @addtogroup itc-notification -* @ingroup itc -* @{ +/** +* @function ReporterEventsErrCB +* @description CallBack function +* @parameter noti_ex_reporter_h hExReporter, noti_ex_error_e eExError, int nReqID, void *data +* @return NA */ +void ReporterEventsErrCB(noti_ex_reporter_h hExReporter, noti_ex_error_e eExError, int nReqID, void *data) +{ + g_CallBackHit = true; +#if DEBUG + FPRINTF("[Line : %d][%s] ReporterEventsErrCB Callback Invoked\\n", __LINE__, API_NAMESPACE); +#endif +} + /** * @function NotificationGetDataPath @@ -124,5 +134,291 @@ gboolean Timeout(gpointer data) } return false; } +/** +* @function NotificationExGetError +* @description Maps error enums to string values +* @parameter nRet : error code returned +* @return error string +*/ +char* NotificationExGetError(int nRet) +{ + char *szErrorVal = "Unknown Error"; + switch ( nRet ) + { + case NOTI_EX_ERROR_NONE: szErrorVal = "NOTI_EX_ERROR_NONE"; break; + case NOTI_EX_ERROR_INVALID_PARAMETER: szErrorVal = "NOTI_EX_ERROR_INVALID_PARAMETER"; break; + case NOTI_EX_ERROR_OUT_OF_MEMORY: szErrorVal = "NOTI_EX_ERROR_OUT_OF_MEMORY"; break; + case NOTI_EX_ERROR_IO_ERROR: szErrorVal = "NOTI_EX_ERROR_IO_ERROR"; break; + case NOTI_EX_ERROR_PERMISSION_DENIED: szErrorVal = "NOTI_EX_ERROR_PERMISSION_DENIED"; break; + case NOTI_EX_ERROR_FROM_DB: szErrorVal = "NOTI_EX_ERROR_FROM_DB"; break; + case NOTI_EX_ERROR_ALREADY_EXIST_ID: szErrorVal = "NOTI_EX_ERROR_ALREADY_EXIST_ID"; break; + case NOTI_EX_ERROR_FROM_DBUS: szErrorVal = "NOTI_EX_ERROR_FROM_DBUS"; break; + case NOTI_EX_ERROR_NOT_EXIST_ID: szErrorVal = "NOTI_EX_ERROR_NOT_EXIST_ID"; break; + case NOTI_EX_ERROR_SERVICE_NOT_READY: szErrorVal = "NOTI_EX_ERROR_SERVICE_NOT_READY"; break; + } + return szErrorVal; +} + +/** +* @function SendNotification +* @description Helper function, sends notification to invoke callback. +* @parameter None +* @return '0' if pass, Error value in case any API fails. +*/ +int SendNotification() +{ + int nRet = NOTI_EX_ERROR_NONE; + int nReqID; + + noti_ex_item_h hGroupItem = NULL; + noti_ex_item_h hButtonItem1 = NULL; + noti_ex_item_h hButtonItem2 = NULL; + + nRet = noti_ex_item_group_create(&hGroupItem, "testgroup"); + PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_group_create", NotificationExGetError(nRet)); + + nRet = noti_ex_item_button_create(&hButtonItem1, "testbtn1", "test1"); + PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_button_create", NotificationExGetError(nRet)); + nRet = noti_ex_item_group_add_child(hGroupItem, hButtonItem1); + PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_group_add_child", NotificationExGetError(nRet)); + + nRet = noti_ex_item_button_create(&hButtonItem2, "testbtn2", "test2"); + PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_button_create", NotificationExGetError(nRet)); + nRet = noti_ex_item_group_add_child(hGroupItem, hButtonItem2); + PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_group_add_child", NotificationExGetError(nRet)); + + nRet = noti_ex_item_set_channel(hGroupItem, "test_channel"); + PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_set_channel", NotificationExGetError(nRet)); + + nRet = noti_ex_reporter_post(g_hEventinfoReporter, hGroupItem, &nReqID); + PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_reporter_post", NotificationExGetError(nRet)); + + return nRet; +} + +/** +* @function CreateChatMsgAttributes +* @description Helper function, create handles prior creation of chat message handle. +* @parameter None +* @return '0' if pass, Error value in case any API fails. +*/ +int CreateChatMsgAttributes() +{ + g_pszNameID = "name_id"; + g_pszNameText = "test_name"; + g_pszTextID = "text_id"; + g_pszTextText = "test_text"; + g_pszImageID = "text_id"; + g_pszImagePath = "test_image_path"; + g_pszTimeID = "time_id"; + g_pszChatID = "chat_id"; + g_eChatMsgType = NOTI_EX_ITEM_CHAT_MESSAGE_TYPE_USER; + + int nRet = NOTI_EX_ERROR_NONE; + nRet = noti_ex_item_text_create(&g_hItemName, g_pszNameID, g_pszNameText, NULL); + PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_text_create", NotificationExGetError(nRet)); + CHECK_HANDLE(g_hItemName, "noti_ex_item_text_create"); + + nRet = noti_ex_item_text_create(&g_hItemText, g_pszTextID, g_pszTextText, NULL); + PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_text_create", NotificationExGetError(nRet), noti_ex_item_destroy(g_hItemName)); + CHECK_HANDLE_CLEANUP(g_hItemText, "noti_ex_item_text_create", noti_ex_item_destroy(g_hItemName)); + + nRet = noti_ex_item_image_create(&g_hItemImage, g_pszImageID, g_pszImagePath); + PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_image_create", NotificationExGetError(nRet), noti_ex_item_destroy(g_hItemName); noti_ex_item_destroy(g_hItemText)); + CHECK_HANDLE_CLEANUP(g_hItemImage, "noti_ex_item_image_create", noti_ex_item_destroy(g_hItemName); noti_ex_item_destroy(g_hItemText)); + + time(&g_tCurrTime); + + nRet = noti_ex_item_time_create(&g_hItemTime, g_pszTimeID, g_tCurrTime); + PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_time_create", NotificationExGetError(nRet), noti_ex_item_destroy(g_hItemName); noti_ex_item_destroy(g_hItemText); noti_ex_item_destroy(g_hItemImage)); + CHECK_HANDLE_CLEANUP(g_hItemName, "noti_ex_item_time_create", noti_ex_item_destroy(g_hItemName); noti_ex_item_destroy(g_hItemText); noti_ex_item_destroy(g_hItemImage)); + return nRet; +} + +/** +* @function DestroyChatMsgAttributes +* @description Helper function, Destroys chat message related handles. +* @parameter None +* @return '0' if pass, Error value in case any API fails. +*/ +int DestroyChatMsgAttributes() +{ + int nRet = NOTI_EX_ERROR_NONE; + nRet = noti_ex_item_destroy(g_hItemName); + PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_destroy", NotificationExGetError(nRet)); + + nRet = noti_ex_item_destroy(g_hItemText); + PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_destroy", NotificationExGetError(nRet)); + + nRet = noti_ex_item_destroy(g_hItemImage); + PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_destroy", NotificationExGetError(nRet)); + + nRet = noti_ex_item_destroy(g_hItemTime); + PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_destroy", NotificationExGetError(nRet)); + + nRet = noti_ex_item_destroy(g_hItemChatMsg); + PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_destroy", NotificationExGetError(nRet)); + return nRet; +} + +/** +* @function CreateStyleAttributes +* @description Helper function, create all required handles for style handle creation. +* @parameter None +* @return '0' if pass, Error value in case any API fails. +*/ +int CreateStyleAttributes() +{ + g_cAlpha = 1; + g_cRed = 2; + g_cGreen = 3; + g_cBlue = 4; + g_nLeft = 1; + g_nTop = 2; + g_nRight = 3; + g_nBottom = 4; + g_nX = 1; + g_nY = 2; + g_nW = 3; + g_nH = 4; + int nRet = NOTI_EX_ERROR_NONE; + + nRet = noti_ex_color_create(&g_hColor, g_cAlpha, g_cRed, g_cGreen, g_cBlue); + PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_color_create", NotificationExGetError(nRet)); + CHECK_HANDLE(g_hColor, "noti_ex_color_create"); + + nRet = noti_ex_padding_create(&g_hPadding, g_nLeft, g_nTop, g_nRight, g_nBottom); + PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_padding_create", NotificationExGetError(nRet), noti_ex_color_destroy(g_hColor)); + CHECK_HANDLE_CLEANUP(g_hPadding, "noti_ex_padding_create", noti_ex_color_destroy(g_hColor)); + + nRet = noti_ex_geometry_create(&g_hGeometry, g_nX, g_nY, g_nW, g_nH); + PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_geometry_create", NotificationExGetError(nRet), noti_ex_color_destroy(g_hColor); noti_ex_padding_destroy(g_hPadding)); + CHECK_HANDLE_CLEANUP(g_hGeometry, "noti_ex_geometry_create", noti_ex_color_destroy(g_hColor); noti_ex_padding_destroy(g_hPadding)); + + nRet = noti_ex_style_create(&g_hStyle, g_hColor, g_hPadding, g_hGeometry); + PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_style_create", NotificationExGetError(nRet), noti_ex_color_destroy(g_hColor); noti_ex_padding_destroy(g_hPadding); noti_ex_geometry_destroy(g_hGeometry)); + CHECK_HANDLE_CLEANUP(g_hStyle, "noti_ex_style_create", noti_ex_color_destroy(g_hColor); noti_ex_padding_destroy(g_hPadding); noti_ex_geometry_destroy(g_hGeometry)); + + return nRet; +} + +/** +* @function DestroyStyleAttributes +* @description Helper function, destroys style and its related handle created. +* @parameter None +* @return '0' if pass, Error value in case any API fails. +*/ +int DestroyStyleAttributes() +{ + int nRet = NOTI_EX_ERROR_NONE; + + nRet = noti_ex_style_destroy(g_hStyle); + PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_style_destroy", NotificationExGetError(nRet)); + + nRet = noti_ex_color_destroy(g_hColor); + PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_color_destroy", NotificationExGetError(nRet)); + + nRet = noti_ex_padding_destroy(g_hPadding); + PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_padding_destroy", NotificationExGetError(nRet)); + + nRet = noti_ex_geometry_destroy(g_hGeometry); + PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_geometry_destroy", NotificationExGetError(nRet)); + + return nRet; +} + +/** +* @function CreateButton +* @description Helper function, to create button ex-item. +* @parameter None +* @return nRet, API return value. +*/ +int CreateButton() +{ + int nRet = NOTI_EX_ERROR_NONE; + g_hItemButton = NULL; + g_pszButtonID = "buttonID"; + g_pszButtonTitle = "buttonTitle"; + + nRet = noti_ex_item_button_create(&g_hItemButton, g_pszButtonID, g_pszButtonTitle); + return nRet; +} + +/** +* @function CreateMultiLangHandle +* @description Helper function, to create multilang handle. +* @parameter None +* @return nRet, API return value. +*/ +int CreateMultiLangHandle() +{ + int nRet = 0; + g_hMultiLang = NULL; + g_pszMsgID = "TEST_ID"; + g_pszText = "test string(%s) integer(%d) float(%f)"; + g_pszArg1 = "test"; + g_nArg2 = 777; + g_fArg3 = 0.77; + + nRet = noti_ex_multi_lang_create(&g_hMultiLang, g_pszMsgID, g_pszText, g_pszArg1, g_nArg2, g_fArg3); + PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_multi_lang_create", NotificationExGetError(nRet)); + CHECK_HANDLE(g_hMultiLang, "noti_ex_multi_lang_create"); + + return nRet; +} +/** +* @function CreateNotificationList +* @description Helper function, create notification and update list. +* @parameter None +* @return '0' if pass, Error value in case any API fails. +*/ +int CreateNotificationList(noti_ex_item_h **pszhItemList) +{ + int nRet = NOTI_EX_ERROR_NONE; + + if (g_hEventinfoReporter == NULL) { + noti_ex_reporter_events_s hReporterEvent = {0}; + hReporterEvent.error = ReporterEventsErrCB; + nRet = noti_ex_reporter_create(&g_hEventinfoReporter, hReporterEvent, NULL); + PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_reporter_create", NotificationExGetError(nRet)); + } + noti_ex_item_h *hItemlist = (noti_ex_item_h*)calloc(2, sizeof(noti_ex_item_h)); + + noti_ex_item_h hGroupItem = NULL; + noti_ex_item_h hButtonItem1 = NULL; + noti_ex_item_h hButtonItem2 = NULL; + + nRet = noti_ex_item_group_create(&hGroupItem, "testgroup"); + PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_group_create", NotificationExGetError(nRet), FREE_MEMORY(hItemlist)); + + nRet = noti_ex_item_button_create(&hButtonItem1, "testbtn1", "test1"); + PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_button_create", NotificationExGetError(nRet), FREE_MEMORY(hItemlist)); + nRet = noti_ex_item_group_add_child(hGroupItem, hButtonItem1); + PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_group_add_child", NotificationExGetError(nRet), FREE_MEMORY(hItemlist)); + + + nRet = noti_ex_item_button_create(&hButtonItem2, "testbtn2", "test2"); + PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_button_create", NotificationExGetError(nRet), FREE_MEMORY(hItemlist)); + nRet = noti_ex_item_group_add_child(hGroupItem, hButtonItem2); + PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_group_add_child", NotificationExGetError(nRet), FREE_MEMORY(hItemlist)); + hItemlist[0] = hGroupItem; + + nRet = noti_ex_item_group_create(&hGroupItem, "testgroup2"); + PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_group_create", NotificationExGetError(nRet), FREE_MEMORY(hItemlist)); + + nRet = noti_ex_item_button_create(&hButtonItem1, "testbtn3", "test3"); + PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_button_create", NotificationExGetError(nRet), FREE_MEMORY(hItemlist)); + nRet = noti_ex_item_group_add_child(hGroupItem, hButtonItem1); + PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_group_add_child", NotificationExGetError(nRet), FREE_MEMORY(hItemlist)); + + + nRet = noti_ex_item_button_create(&hButtonItem2, "testbtn4", "test4"); + PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_button_create", NotificationExGetError(nRet), FREE_MEMORY(hItemlist)); + nRet = noti_ex_item_group_add_child(hGroupItem, hButtonItem2); + PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_group_add_child", NotificationExGetError(nRet), FREE_MEMORY(hItemlist)); + hItemlist[1] = hGroupItem; + + *pszhItemList = hItemlist; + return nRet; +} -/** @} */ //end of itc-notification diff --git a/src/itc/notification/ITs-notification-common.h b/src/itc/notification/ITs-notification-common.h index ea51035ae..00b0dd378 100755 --- a/src/itc/notification/ITs-notification-common.h +++ b/src/itc/notification/ITs-notification-common.h @@ -21,10 +21,11 @@ #include #include -/** @addtogroup itc-notification -* @ingroup itc -* @{ -*/ +#include +#include +#include + +#define TEST_APPID "org.tizen.noti_ex_manager" #define API_NAMESPACE "NOTIFICATION_ITC" #define MICROSECONDS_PER_SECOND 1000000 @@ -111,6 +112,21 @@ const char *g_pszButtonTitle; const char *g_pszMsgID; const char *g_pszText; const char *g_pszArg1; +noti_ex_reporter_h g_hEventinfoReporter; +noti_ex_manager_h g_hEventinfoManager; +noti_ex_manager_h g_hExManager; +noti_ex_item_h g_hItemButton; +noti_ex_item_h g_hItemChatMsg; +noti_ex_item_h g_hItemName; +noti_ex_item_h g_hItemText; +noti_ex_item_h g_hItemImage; +noti_ex_item_h g_hItemTime; +noti_ex_style_h g_hStyle; +noti_ex_color_h g_hColor; +noti_ex_padding_h g_hPadding; +noti_ex_geometry_h g_hGeometry; +noti_ex_multi_lang_h g_hMultiLang; +noti_ex_item_chat_message_type_e g_eChatMsgType; unsigned char g_cAlpha, g_cRed, g_cGreen, g_cBlue; int g_nLeft, g_nTop, g_nRight, g_nBottom, g_nX, g_nY, g_nW, g_nH, g_nArg2; @@ -128,6 +144,7 @@ int CreateStyleAttributes(); int DestroyStyleAttributes(); int CreateButton(); int CreateMultiLangHandle(); +int CreateNotificationList(noti_ex_item_h **pszhItemList); //This function outputs the application data path bool NotificationGetDataPath(char* pPath); @@ -135,6 +152,8 @@ bool NotificationGetDataPath(char* pPath); //This function appends the input string to app data path and outputs the final resultant path bool NotificationAppendToAppDataPath(char* pInputPath, char* pFinalPath); +int NotificationAppCreate(); + /** @} */ //end of itc-notification #endif //_ITS_NOTIFICATION_COMMON_H_ diff --git a/src/itc/notification/ITs-notification-ex-action_app_control.c b/src/itc/notification/ITs-notification-ex-action_app_control.c new file mode 100755 index 000000000..28397183f --- /dev/null +++ b/src/itc/notification/ITs-notification-ex-action_app_control.c @@ -0,0 +1,160 @@ +// +// 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-notification-common.h" +/** +* @function ITs_notification_ex_action_app_control_startup +* @description Called before each test +* @parameter NA +* @return NA +*/ +void ITs_notification_ex_action_app_control_startup(void) +{ + struct stat stBuff; + if ( stat(ERR_LOG, &stBuff) == 0 ) + { + remove(ERR_LOG); + } +#if DEBUG + FPRINTF("[Line : %d][%s] TEST SUIT start-up: ITs_notification_ex_action_app_control_startup \\n", __LINE__, API_NAMESPACE); +#endif + + return; +} + +/** +* @function ITs_notification_ex_action_app_control_cleanup +* @description Called after each test +* @parameter NA +* @return NA +*/ +void ITs_notification_ex_action_app_control_cleanup(void) +{ +#if DEBUG + FPRINTF("[Line : %d][%s] TEST SUIT clean-up: ITs_notification_ex_action_app_control_cleanup \\n", __LINE__, API_NAMESPACE); +#endif + return; +} +//& type : auto +//& purpose: Creates a notification app control. +/** +* @testcase ITc_noti_ex_action_app_control_create_p +* @since_tizen 5.5 +* @author SRID(j.abhishek) +* @reviewer SRID(shobhit.v) +* @type auto +* @description Creates notification-ex app control handler. +* @scenario Create notification\n +* Check return value and also check handle is null or not. +* @apicovered noti_ex_action_app_control_create +* @passcase noti_ex_action_app_control_create is successful and return correct value +* @failcase noti_ex_action_app_control_create gets failed or return null value +* @precondition Create app control and set app id to a dummy app id. +* @postcondition Destroy app control and app control action handler. +*/ +int ITc_noti_ex_action_app_control_create_p(void) +{ + START_TEST; + + int nRet = APP_CONTROL_ERROR_NONE; + app_control_h hAppControl; + noti_ex_action_h hAction = NULL; + + nRet = app_control_create(&hAppControl); + PRINT_RESULT(APP_CONTROL_ERROR_NONE, nRet, "app_control_create", Application_AppControlGetError(nRet)); + CHECK_HANDLE(hAppControl, "app_control_create"); + + const char* pszSetAppID = "org.tizen.app"; //dummy app id + nRet = app_control_set_app_id(hAppControl, pszSetAppID); + PRINT_RESULT_CLEANUP(APP_CONTROL_ERROR_NONE, nRet, "app_control_set_app_id", Application_AppControlGetError(nRet), app_control_destroy(hAppControl)); + + //Target API + nRet = noti_ex_action_app_control_create(&hAction, hAppControl, NULL); + PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_action_app_control_create", NotificationExGetError(nRet), app_control_destroy(hAppControl)); + CHECK_HANDLE_CLEANUP(hAction, "noti_ex_action_app_control_create", app_control_destroy(hAppControl)); + + nRet = app_control_destroy(hAppControl); + PRINT_RESULT_NORETURN(APP_CONTROL_ERROR_NONE, nRet, "app_control_destroy", Application_AppControlGetError(nRet)); + + nRet = noti_ex_action_destroy(hAction); + PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_action_destroy", NotificationExGetError(nRet)); + + return 0; +} + +//& type : auto +//& purpose: Sets and Gets new app control handle from action +/** +* @testcase ITc_noti_ex_action_app_control_set_get_p +* @since_tizen 5.5 +* @author SRID(j.abhishek) +* @reviewer SRID(shobhit.v) +* @type auto +* @description Sets and Gets new app control handle from action. +* @scenario Create notification\n +* Gets new app control from action handler and check for Pass/Fail. +* @apicovered noti_ex_action_app_control_set, noti_ex_action_app_control_get +* @passcase noti_ex_action_app_control_set, noti_ex_action_app_control_get are successful and return correct value +* @failcase noti_ex_action_app_control_set, noti_ex_action_app_control_get gets failed or return null value +* @precondition Create app control and set app id to a dummy app id. +* @postcondition Destroy app control and app control action handler. +*/ +int ITc_noti_ex_action_app_control_set_get_p(void) +{ + START_TEST; + + int nRet = APP_CONTROL_ERROR_NONE; + app_control_h hAppControl; + app_control_h hAppControlSet; + app_control_h hAppControlGet = NULL; + noti_ex_action_h hAction = NULL; + + nRet = app_control_create(&hAppControl); + PRINT_RESULT(APP_CONTROL_ERROR_NONE, nRet, "app_control_create", Application_AppControlGetError(nRet)); + CHECK_HANDLE(hAppControl, "app_control_create"); + + const char* pszSetAppID = "org.tizen.app"; //dummy app id + nRet = app_control_set_app_id(hAppControl, pszSetAppID); + PRINT_RESULT_CLEANUP(APP_CONTROL_ERROR_NONE, nRet, "app_control_set_app_id", Application_AppControlGetError(nRet), app_control_destroy(hAppControl)); + + nRet = noti_ex_action_app_control_create(&hAction, hAppControl, NULL); + PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_action_app_control_create", NotificationExGetError(nRet), app_control_destroy(hAppControl)); + CHECK_HANDLE_CLEANUP(hAction, "noti_ex_action_app_control_creat", app_control_destroy(hAppControl)); + + nRet = app_control_create(&hAppControlSet); + PRINT_RESULT_CLEANUP(APP_CONTROL_ERROR_NONE, nRet, "app_control_create", Application_AppControlGetError(nRet), app_control_destroy(hAppControl); noti_ex_action_destroy(hAction)); + CHECK_HANDLE_CLEANUP(hAppControlSet, "app_control_create", app_control_destroy(hAppControl); noti_ex_action_destroy(hAction)); + + const char* pNewAppID = "org.tizen.newapp"; //dummy app id + nRet = app_control_set_app_id(hAppControlSet, pNewAppID); + PRINT_RESULT_CLEANUP(APP_CONTROL_ERROR_NONE, nRet, "app_control_set_app_id", Application_AppControlGetError(nRet), app_control_destroy(hAppControl); noti_ex_action_destroy(hAction)); + + //Target API + nRet = noti_ex_action_app_control_set(hAction, hAppControlSet); + PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_action_app_control_set", NotificationExGetError(nRet), app_control_destroy(hAppControl); noti_ex_action_destroy(hAction)); + + //Target API + nRet = noti_ex_action_app_control_get(hAction, &hAppControlGet); + PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_action_app_control_get", NotificationExGetError(nRet), app_control_destroy(hAppControl); noti_ex_action_destroy(hAction)); + CHECK_HANDLE_CLEANUP(hAppControlGet, "noti_ex_action_app_control_get", app_control_destroy(hAppControl); noti_ex_action_destroy(hAction)); + + nRet = app_control_destroy(hAppControl); + PRINT_RESULT_NORETURN(APP_CONTROL_ERROR_NONE, nRet, "app_control_destroy", Application_AppControlGetError(nRet)); + + nRet = noti_ex_action_destroy(hAction); + PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_action_destroy", NotificationExGetError(nRet)); + + return 0; +} diff --git a/src/itc/notification/ITs-notification-ex-button.c b/src/itc/notification/ITs-notification-ex-button.c new file mode 100755 index 000000000..ff481a9e3 --- /dev/null +++ b/src/itc/notification/ITs-notification-ex-button.c @@ -0,0 +1,177 @@ +// +// 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-notification-common.h" +/** +* @function ITs_notification_ex_button_startup +* @description Called before each test +* @parameter NA +* @return NA +*/ +void ITs_notification_ex_button_startup(void) +{ + struct stat stBuff; + if ( stat(ERR_LOG, &stBuff) == 0 ) + { + remove(ERR_LOG); + } +#if DEBUG + FPRINTF("[Line : %d][%s] TEST SUIT start-up: ITs_notification_ex_button_startup \\n", __LINE__, API_NAMESPACE); +#endif + + return; +} + +/** +* @function ITs_notification_ex_button_cleanup +* @description Called after each test +* @parameter NA +* @return NA +*/ +void ITs_notification_ex_button_cleanup(void) +{ +#if DEBUG + FPRINTF("[Line : %d][%s] TEST SUIT clean-up: ITs_notification_ex_button_cleanup \\n", __LINE__, API_NAMESPACE); +#endif + return; +} +//& type : auto +//& purpose: Creates the notification_ex item handle with a button. +/** +* @testcase ITc_noti_ex_item_button_create_p +* @since_tizen 5.5 +* @author SRID(j.abhishek) +* @reviewer SRID(shobhit.v) +* @type auto +* @description Creates the notification_ex item handle with a button. +* @scenario Creates the notification_ex item handle with a button \n +* Check for Pass/Fail. +* @apicovered noti_ex_item_button_create +* @passcase noti_ex_item_button_create is successful and return correct value +* @failcase noti_ex_item_button_create failed or return null value +* @precondition NA. +* @postcondition Destroy handle. +*/ +int ITc_noti_ex_item_button_create_p(void) +{ + START_TEST; + + int nRet = NOTI_EX_ERROR_NONE; + + //Taregt API + nRet = CreateButton(); + PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_button_create", NotificationExGetError(nRet)); + CHECK_HANDLE(g_hItemButton, "noti_ex_item_button_create"); + + nRet = noti_ex_item_destroy(g_hItemButton); + PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_destroy", NotificationExGetError(nRet)); + + return 0; +} + +//& type : auto +//& purpose: Gets the title of a button item. +/** +* @testcase ITc_noti_ex_item_button_get_title_p +* @since_tizen 5.5 +* @author SRID(j.abhishek) +* @reviewer SRID(shobhit.v) +* @type auto +* @description Gets the title of a button item. +* @scenario Creates the notification_ex item handle with a button \n +* Gets the title and compare with Set title. Check for Pass/Fail. +* @apicovered noti_ex_item_button_get_title +* @passcase noti_ex_item_button_get_title is successful and return correct value +* @failcase noti_ex_item_button_get_title failed or return null value +* @precondition NA. +* @postcondition Free Title pointer memory and destroy handle. +*/ +int ITc_noti_ex_item_button_get_title_p(void) +{ + START_TEST; + + int nRet = NOTI_EX_ERROR_NONE; + char* pszGetTitle = NULL; + + nRet = CreateButton(); + PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_button_create", NotificationExGetError(nRet)); + CHECK_HANDLE(g_hItemButton, "noti_ex_item_button_create"); + + //Taregt API + nRet = noti_ex_item_button_get_title(g_hItemButton, &pszGetTitle); + PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_button_get_title", NotificationExGetError(nRet), noti_ex_item_destroy(g_hItemButton)); + CHECK_HANDLE_CLEANUP(pszGetTitle, "noti_ex_item_button_get_title", noti_ex_item_destroy(g_hItemButton)); + + if (strncmp(g_pszButtonTitle, pszGetTitle, strlen(pszGetTitle) + 1)) + { + FPRINTF("[Line : %d][%s] noti_ex_item_button_get_title: return title is different from set title [%s]\\n", __LINE__, API_NAMESPACE, pszGetTitle); + FREE_MEMORY(pszGetTitle); + + nRet = noti_ex_item_destroy(g_hItemButton); + PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_destroy", NotificationExGetError(nRet)); + + return 1; + } + + FREE_MEMORY(pszGetTitle); + + nRet = noti_ex_item_destroy(g_hItemButton); + PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_destroy", NotificationExGetError(nRet)); + + return 0; +} +//& type : auto +//& purpose: Sets the multi-language handle for button. +/** +* @testcase ITc_noti_ex_item_button_set_multi_language_title_p +* @since_tizen 5.5 +* @author SRID(manu.tiwari) +* @reviewer SRID(j.abhishek) +* @type auto +* @description Sets the multi-language handle for button. +* @scenario Creates the notification_ex button and multi langauge handle \n +* Sets the multi-language handle for button \n +* and check for Pass/Fail. +* @apicovered noti_ex_item_button_set_multi_language_title +* @passcase noti_ex_item_button_set_multi_language_title is successful and return correct value +* @failcase noti_ex_item_button_set_multi_language_title failed or return null value +* @precondition NA +* @postcondition Destroy handle. +*/ +int ITc_noti_ex_item_button_set_multi_language_title_p(void) +{ + START_TEST; + + int nRet = NOTI_EX_ERROR_NONE; + + nRet = CreateButton(); + PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_button_create", NotificationExGetError(nRet)); + CHECK_HANDLE(g_hItemButton, "noti_ex_item_button_create"); + + nRet = CreateMultiLangHandle(); + PRINT_RESULT_CLEANUP(0, nRet, "noti_ex_multi_lang_create", "API failed or handle not created successfully", noti_ex_item_destroy(g_hItemButton)); + + //Target API + nRet = noti_ex_item_button_set_multi_language_title(g_hItemButton, g_hMultiLang); + PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_button_set_multi_language_title", NotificationExGetError(nRet), noti_ex_item_destroy(g_hItemButton); noti_ex_multi_lang_destroy(g_hMultiLang)); + + nRet = noti_ex_multi_lang_destroy(g_hMultiLang); + PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_multi_lang_destroy", NotificationExGetError(nRet)); + + nRet = noti_ex_item_destroy(g_hItemButton); + PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_destroy", NotificationExGetError(nRet)); + + return 0; +} diff --git a/src/itc/notification/ITs-notification-ex-chat-message.c b/src/itc/notification/ITs-notification-ex-chat-message.c new file mode 100755 index 000000000..6ffee1128 --- /dev/null +++ b/src/itc/notification/ITs-notification-ex-chat-message.c @@ -0,0 +1,400 @@ +// +// 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-notification-common.h" +/** +* @function ITs_notification_ex_chat_message_startup +* @description Called before each test +* @parameter NA +* @return NA +*/ +void ITs_notification_ex_chat_message_startup(void) +{ + struct stat stBuff; + if ( stat(ERR_LOG, &stBuff) == 0 ) + { + remove(ERR_LOG); + } +#if DEBUG + FPRINTF("[Line : %d][%s] TEST SUIT start-up: ITs_notification_ex_chat_message_startup \\n", __LINE__, API_NAMESPACE); +#endif + + return; +} + +/** +* @function ITs_notification_ex_chat_message_cleanup +* @description Called after each test +* @parameter NA +* @return NA +*/ +void ITs_notification_ex_chat_message_cleanup(void) +{ +#if DEBUG + FPRINTF("[Line : %d][%s] TEST SUIT clean-up: ITs_notification_ex_chat_message_cleanup \\n", __LINE__, API_NAMESPACE); +#endif + return; +} +//& type : auto +//& purpose: Creates the notification_ex item handle for the chat message. +/** +* @testcase ITc_noti_ex_item_chat_message_create_p +* @since_tizen 5.5 +* @author SRID(j.abhishek) +* @reviewer SRID(shobhit.v) +* @type auto +* @description Creates the notification_ex item handle for the chat message. +* @scenario Creates the notification_ex item handle for the chat message \n +* Check for handle and check for Pass/Fail. +* @apicovered noti_ex_item_chat_message_create +* @passcase noti_ex_item_chat_message_create is successful and return correct value +* @failcase noti_ex_item_chat_message_create failed or return null value +* @precondition Name, Text and Image must be created before creating chat message. +* @postcondition Free Title pointer memory and destroy handle. +*/ +int ITc_noti_ex_item_chat_message_create_p(void) +{ + START_TEST; + + int nRet = NOTI_EX_ERROR_NONE; + noti_ex_item_h hItemChatMsg = NULL; + + nRet = CreateChatMsgAttributes(); + if(nRet) + { + FPRINTF("[Line : %d][%s] One of the API inside CreateChatMsgAttributes() is failed \\n", __LINE__, API_NAMESPACE); + return 1; + } + + noti_ex_item_chat_message_type_e eChatMsgType[] = { + NOTI_EX_ITEM_CHAT_MESSAGE_TYPE_USER, + NOTI_EX_ITEM_CHAT_MESSAGE_TYPE_SENDER + }; + + int nEnumSize = sizeof(eChatMsgType) / sizeof(eChatMsgType[0]); + int nEnumCounter; + + for ( nEnumCounter=0; nEnumCounter - -noti_ex_reporter_h g_hEventinfoReporter; -noti_ex_manager_h g_hEventinfoManager; -noti_ex_manager_h g_hExManager; -noti_ex_item_h g_hItemButton; -noti_ex_item_h g_hItemChatMsg; -noti_ex_item_h g_hItemName; -noti_ex_item_h g_hItemText; -noti_ex_item_h g_hItemImage; -noti_ex_item_h g_hItemTime; -noti_ex_style_h g_hStyle; -noti_ex_color_h g_hColor; -noti_ex_padding_h g_hPadding; -noti_ex_geometry_h g_hGeometry; -noti_ex_multi_lang_h g_hMultiLang; -noti_ex_item_chat_message_type_e g_eChatMsgType; -void ReporterEventsErrorCB(noti_ex_reporter_h hExReporter, noti_ex_error_e eExError, int nReqID, void *data); -int CreateNotificationList(noti_ex_item_h **pszhItemList); - - -void ReporterEventsErrorCB(noti_ex_reporter_h hExReporter, noti_ex_error_e eExError, int nReqID, void *data) -{ - g_CallBackHit = true; -#if DEBUG - FPRINTF("[Line : %d][%s] ReporterEventsErrorCB Callback Invoked\\n", __LINE__, API_NAMESPACE); -#endif -} - -void EventinfoReporterEventsErrorCB(noti_ex_reporter_h handle, noti_ex_error_e error, int req_id, void *data) -{ - g_CallBackHit = true; -#if DEBUG - FPRINTF("[Line : %d][%s] EventinfoReporterEventsErrorCB Callback Invoked\\n", __LINE__, API_NAMESPACE); -#endif -} - -/** -* @function NotificationExGetError -* @description Maps error enums to string values -* @parameter nRet : error code returned -* @return error string -*/ -char* NotificationExGetError(int nRet) -{ - char *szErrorVal = "Unknown Error"; - switch ( nRet ) - { - case NOTI_EX_ERROR_NONE: szErrorVal = "NOTI_EX_ERROR_NONE"; break; - case NOTI_EX_ERROR_INVALID_PARAMETER: szErrorVal = "NOTI_EX_ERROR_INVALID_PARAMETER"; break; - case NOTI_EX_ERROR_OUT_OF_MEMORY: szErrorVal = "NOTI_EX_ERROR_OUT_OF_MEMORY"; break; - case NOTI_EX_ERROR_IO_ERROR: szErrorVal = "NOTI_EX_ERROR_IO_ERROR"; break; - case NOTI_EX_ERROR_PERMISSION_DENIED: szErrorVal = "NOTI_EX_ERROR_PERMISSION_DENIED"; break; - case NOTI_EX_ERROR_FROM_DB: szErrorVal = "NOTI_EX_ERROR_FROM_DB"; break; - case NOTI_EX_ERROR_ALREADY_EXIST_ID: szErrorVal = "NOTI_EX_ERROR_ALREADY_EXIST_ID"; break; - case NOTI_EX_ERROR_FROM_DBUS: szErrorVal = "NOTI_EX_ERROR_FROM_DBUS"; break; - case NOTI_EX_ERROR_NOT_EXIST_ID: szErrorVal = "NOTI_EX_ERROR_NOT_EXIST_ID"; break; - case NOTI_EX_ERROR_SERVICE_NOT_READY: szErrorVal = "NOTI_EX_ERROR_SERVICE_NOT_READY"; break; - } - return szErrorVal; -} - -/** -* @function SendNotification -* @description Helper function, sends notification to invoke callback. -* @parameter None -* @return '0' if pass, Error value in case any API fails. -*/ -int SendNotification() -{ - int nReqID; - int nRet = NOTI_EX_ERROR_NONE; - - if (g_hEventinfoReporter == NULL) { - noti_ex_reporter_events_s hEvent = {0}; - hEvent.error = EventinfoReporterEventsErrorCB; - nRet = noti_ex_reporter_create(&g_hEventinfoReporter, hEvent, NULL); - CHECK_HANDLE(g_hEventinfoReporter, "noti_ex_reporter_create"); - PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_reporter_create", NotificationExGetError(nRet)); - } - nRet = noti_ex_reporter_delete_all(g_hEventinfoReporter, &nReqID); - PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_reporter_delete_all", NotificationExGetError(nRet)); - - noti_ex_item_h hGroupItem = NULL; - noti_ex_item_h hButtonItem1 = NULL; - noti_ex_item_h hButtonItem2 = NULL; - - nRet = noti_ex_item_group_create(&hGroupItem, "testgroup"); - PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_group_create", NotificationExGetError(nRet)); - - nRet = noti_ex_item_button_create(&hButtonItem1, "testbtn1", "test1"); - PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_button_create", NotificationExGetError(nRet)); - nRet = noti_ex_item_group_add_child(hGroupItem, hButtonItem1); - PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_group_add_child", NotificationExGetError(nRet)); - - nRet = noti_ex_item_button_create(&hButtonItem2, "testbtn2", "test2"); - PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_button_create", NotificationExGetError(nRet)); - nRet = noti_ex_item_group_add_child(hGroupItem, hButtonItem2); - PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_group_add_child", NotificationExGetError(nRet)); - - nRet = noti_ex_item_set_channel(hGroupItem, "test_channel"); - PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_set_channel", NotificationExGetError(nRet)); - - nRet = noti_ex_reporter_post(g_hEventinfoReporter, hGroupItem, &nReqID); - PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_reporter_post", NotificationExGetError(nRet)); - - return nRet; -} - -/** -* @function CreateChatMsgAttributes -* @description Helper function, create handles prior creation of chat message handle. -* @parameter None -* @return '0' if pass, Error value in case any API fails. -*/ -int CreateChatMsgAttributes() -{ - g_pszNameID = "name_id"; - g_pszNameText = "test_name"; - g_pszTextID = "text_id"; - g_pszTextText = "test_text"; - g_pszImageID = "text_id"; - g_pszImagePath = "test_image_path"; - g_pszTimeID = "time_id"; - g_pszChatID = "chat_id"; - g_eChatMsgType = NOTI_EX_ITEM_CHAT_MESSAGE_TYPE_USER; - - int nRet = NOTI_EX_ERROR_NONE; - nRet = noti_ex_item_text_create(&g_hItemName, g_pszNameID, g_pszNameText, NULL); - PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_text_create", NotificationExGetError(nRet)); - CHECK_HANDLE(g_hItemName, "noti_ex_item_text_create"); - - nRet = noti_ex_item_text_create(&g_hItemText, g_pszTextID, g_pszTextText, NULL); - PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_text_create", NotificationExGetError(nRet), noti_ex_item_destroy(g_hItemName)); - CHECK_HANDLE_CLEANUP(g_hItemText, "noti_ex_item_text_create", noti_ex_item_destroy(g_hItemName)); - - nRet = noti_ex_item_image_create(&g_hItemImage, g_pszImageID, g_pszImagePath); - PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_image_create", NotificationExGetError(nRet), noti_ex_item_destroy(g_hItemName); noti_ex_item_destroy(g_hItemText)); - CHECK_HANDLE_CLEANUP(g_hItemImage, "noti_ex_item_image_create", noti_ex_item_destroy(g_hItemName); noti_ex_item_destroy(g_hItemText)); - - time(&g_tCurrTime); - - nRet = noti_ex_item_time_create(&g_hItemTime, g_pszTimeID, g_tCurrTime); - PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_time_create", NotificationExGetError(nRet), noti_ex_item_destroy(g_hItemName); noti_ex_item_destroy(g_hItemText); noti_ex_item_destroy(g_hItemImage)); - CHECK_HANDLE_CLEANUP(g_hItemName, "noti_ex_item_time_create", noti_ex_item_destroy(g_hItemName); noti_ex_item_destroy(g_hItemText); noti_ex_item_destroy(g_hItemImage)); - return nRet; -} - -/** -* @function DestroyChatMsgAttributes -* @description Helper function, Destroys chat message related handles. -* @parameter None -* @return '0' if pass, Error value in case any API fails. -*/ -int DestroyChatMsgAttributes() -{ - int nRet = NOTI_EX_ERROR_NONE; - nRet = noti_ex_item_destroy(g_hItemName); - PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_destroy", NotificationExGetError(nRet)); - - nRet = noti_ex_item_destroy(g_hItemText); - PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_destroy", NotificationExGetError(nRet)); - - nRet = noti_ex_item_destroy(g_hItemImage); - PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_destroy", NotificationExGetError(nRet)); - - nRet = noti_ex_item_destroy(g_hItemTime); - PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_destroy", NotificationExGetError(nRet)); - - nRet = noti_ex_item_destroy(g_hItemChatMsg); - PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_destroy", NotificationExGetError(nRet)); - return nRet; -} - -/** -* @function CreateStyleAttributes -* @description Helper function, create all required handles for style handle creation. -* @parameter None -* @return '0' if pass, Error value in case any API fails. -*/ -int CreateStyleAttributes() -{ - g_cAlpha = 1; - g_cRed = 2; - g_cGreen = 3; - g_cBlue = 4; - g_nLeft = 1; - g_nTop = 2; - g_nRight = 3; - g_nBottom = 4; - g_nX = 1; - g_nY = 2; - g_nW = 3; - g_nH = 4; - int nRet = NOTI_EX_ERROR_NONE; - - nRet = noti_ex_color_create(&g_hColor, g_cAlpha, g_cRed, g_cGreen, g_cBlue); - PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_color_create", NotificationExGetError(nRet)); - CHECK_HANDLE(g_hColor, "noti_ex_color_create"); - - nRet = noti_ex_padding_create(&g_hPadding, g_nLeft, g_nTop, g_nRight, g_nBottom); - PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_padding_create", NotificationExGetError(nRet), noti_ex_color_destroy(g_hColor)); - CHECK_HANDLE_CLEANUP(g_hPadding, "noti_ex_padding_create", noti_ex_color_destroy(g_hColor)); - - nRet = noti_ex_geometry_create(&g_hGeometry, g_nX, g_nY, g_nW, g_nH); - PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_geometry_create", NotificationExGetError(nRet), noti_ex_color_destroy(g_hColor); noti_ex_padding_destroy(g_hPadding)); - CHECK_HANDLE_CLEANUP(g_hGeometry, "noti_ex_geometry_create", noti_ex_color_destroy(g_hColor); noti_ex_padding_destroy(g_hPadding)); - - nRet = noti_ex_style_create(&g_hStyle, g_hColor, g_hPadding, g_hGeometry); - PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_style_create", NotificationExGetError(nRet), noti_ex_color_destroy(g_hColor); noti_ex_padding_destroy(g_hPadding); noti_ex_geometry_destroy(g_hGeometry)); - CHECK_HANDLE_CLEANUP(g_hStyle, "noti_ex_style_create", noti_ex_color_destroy(g_hColor); noti_ex_padding_destroy(g_hPadding); noti_ex_geometry_destroy(g_hGeometry)); - - return nRet; -} - -/** -* @function DestroyStyleAttributes -* @description Helper function, destroys style and its related handle created. -* @parameter None -* @return '0' if pass, Error value in case any API fails. -*/ -int DestroyStyleAttributes() -{ - int nRet = NOTI_EX_ERROR_NONE; - - nRet = noti_ex_style_destroy(g_hStyle); - PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_style_destroy", NotificationExGetError(nRet)); - - nRet = noti_ex_color_destroy(g_hColor); - PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_color_destroy", NotificationExGetError(nRet)); - - nRet = noti_ex_padding_destroy(g_hPadding); - PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_padding_destroy", NotificationExGetError(nRet)); - - nRet = noti_ex_geometry_destroy(g_hGeometry); - PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_geometry_destroy", NotificationExGetError(nRet)); - - return nRet; -} - -/** -* @function CreateButton -* @description Helper function, to create button ex-item. -* @parameter None -* @return nRet, API return value. -*/ -int CreateButton() -{ - int nRet = NOTI_EX_ERROR_NONE; - g_hItemButton = NULL; - g_pszButtonID = "buttonID"; - g_pszButtonTitle = "buttonTitle"; - - nRet = noti_ex_item_button_create(&g_hItemButton, g_pszButtonID, g_pszButtonTitle); - return nRet; -} - -/** -* @function CreateMultiLangHandle -* @description Helper function, to create multilang handle. -* @parameter None -* @return nRet, API return value. -*/ -int CreateMultiLangHandle() -{ - int nRet = 0; - g_hMultiLang = NULL; - g_pszMsgID = "TEST_ID"; - g_pszText = "test string(%s) integer(%d) float(%f)"; - g_pszArg1 = "test"; - g_nArg2 = 777; - g_fArg3 = 0.77; - - nRet = noti_ex_multi_lang_create(&g_hMultiLang, g_pszMsgID, g_pszText, g_pszArg1, g_nArg2, g_fArg3); - PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_multi_lang_create", NotificationExGetError(nRet)); - CHECK_HANDLE(g_hMultiLang, "noti_ex_multi_lang_create"); - - return nRet; -} -/** -* @function CreateNotificationList -* @description Helper function, create notification and update list. -* @parameter None -* @return '0' if pass, Error value in case any API fails. -*/ -int CreateNotificationList(noti_ex_item_h **pszhItemList) -{ - int nRet = NOTI_EX_ERROR_NONE; - - if (g_hEventinfoReporter == NULL) { - noti_ex_reporter_events_s hReporterEvent = {0}; - hReporterEvent.error = ReporterEventsErrorCB; - nRet = noti_ex_reporter_create(&g_hEventinfoReporter, hReporterEvent, NULL); - PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_reporter_create", NotificationExGetError(nRet)); - } - noti_ex_item_h *hItemlist = (noti_ex_item_h*)calloc(2, sizeof(noti_ex_item_h)); - - noti_ex_item_h hGroupItem = NULL; - noti_ex_item_h hButtonItem1 = NULL; - noti_ex_item_h hButtonItem2 = NULL; - - nRet = noti_ex_item_group_create(&hGroupItem, "testgroup"); - PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_group_create", NotificationExGetError(nRet), FREE_MEMORY(hItemlist)); - - nRet = noti_ex_item_button_create(&hButtonItem1, "testbtn1", "test1"); - PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_button_create", NotificationExGetError(nRet), FREE_MEMORY(hItemlist)); - nRet = noti_ex_item_group_add_child(hGroupItem, hButtonItem1); - PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_group_add_child", NotificationExGetError(nRet), FREE_MEMORY(hItemlist)); - - - nRet = noti_ex_item_button_create(&hButtonItem2, "testbtn2", "test2"); - PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_button_create", NotificationExGetError(nRet), FREE_MEMORY(hItemlist)); - nRet = noti_ex_item_group_add_child(hGroupItem, hButtonItem2); - PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_group_add_child", NotificationExGetError(nRet), FREE_MEMORY(hItemlist)); - hItemlist[0] = hGroupItem; - - nRet = noti_ex_item_group_create(&hGroupItem, "testgroup2"); - PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_group_create", NotificationExGetError(nRet), FREE_MEMORY(hItemlist)); - - nRet = noti_ex_item_button_create(&hButtonItem1, "testbtn3", "test3"); - PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_button_create", NotificationExGetError(nRet), FREE_MEMORY(hItemlist)); - nRet = noti_ex_item_group_add_child(hGroupItem, hButtonItem1); - PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_group_add_child", NotificationExGetError(nRet), FREE_MEMORY(hItemlist)); - - - nRet = noti_ex_item_button_create(&hButtonItem2, "testbtn4", "test4"); - PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_button_create", NotificationExGetError(nRet), FREE_MEMORY(hItemlist)); - nRet = noti_ex_item_group_add_child(hGroupItem, hButtonItem2); - PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_group_add_child", NotificationExGetError(nRet), FREE_MEMORY(hItemlist)); - hItemlist[1] = hGroupItem; - - *pszhItemList = hItemlist; - return nRet; -} -/** @addtogroup itc-notification_ex -* @ingroup itc -* @{ -*/ - -//& set: notification-ex - -/****************************************************Callback Start****************************************************/ - -/** -* @function NotiExItemGroupForeachChildCb -* @description Callback Function -* @parameters noti_ex_item_h hItem, void *pszData -* @return int -*/ -static int NotiExItemGroupForeachChildCb(noti_ex_item_h hItem, void *pszData) -{ - int nRet; - char *pszGetID = NULL; - g_CallBackHit = false; - - FPRINTF("[Line : %d][%s] NotiExItemGroupForeachChildCb Callback Invoked\\n", __LINE__, API_NAMESPACE); - g_CallBackHit = true; - - nRet = noti_ex_item_get_id(hItem, &pszGetID); - if (nRet != NOTI_EX_ERROR_NONE) - { - FPRINTF("[Line : %d][%s] Error in running API noti_ex_item_get_id\\n", __LINE__, API_NAMESPACE); - return 1; - } - - if ( strncmp(pszGetID, g_pszButtonID, strlen(g_pszButtonID) + 1) ) - { - FPRINTF("[Line : %d][%s] Chiled id [%s] but recieved id is [%s] \\n", __LINE__, API_NAMESPACE, g_pszButtonID, pszGetID); - return 1; - } - return 0; -} - -void EventinfoManagerEventsErrorCB(noti_ex_reporter_h hNotiReporter, noti_ex_error_e eNotiError, int nReqID, void *pszData) -{ - g_CallBackHit = true; -#if DEBUG - FPRINTF("[Line : %d][%s] EventinfoManagerEventsErrorCB Callback Invoked\\n", __LINE__, API_NAMESPACE); -#endif -} - -void EventinfoGettestEventsAddCB(noti_ex_manager_h hNotiManager, noti_ex_event_info_h hNotiInfo, noti_ex_item_h *hNotiItem, int nCount, void *pszData) -{ - int nRet; - noti_ex_event_info_type_e eEventInfoType; - noti_ex_event_info_h hEventInfo = NULL; - char *pszOwner = NULL; - char *pszChannel = NULL; - char *pszItemID = NULL; - int nReqID; - - g_CallBackHit = false; - g_bAPIFailed = false; - - FPRINTF("[Line : %d][%s] EventinfoGettestEventsAddCB callback hit \\n", __LINE__, API_NAMESPACE); - - if(EX_EVENT_INFO_CLONE == g_eEventInfoAPI) - { - nRet = noti_ex_event_info_clone(hNotiInfo, &hEventInfo); - PRINT_RESULT_CALLBACK_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_event_info_clone", NotificationExGetError(nRet)); - } - - if(EX_EVENT_INFO_GET_EVENT_TYPE == g_eEventInfoAPI) - { - nRet = noti_ex_event_info_get_event_type(hNotiInfo, &eEventInfoType); - PRINT_RESULT_CALLBACK_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_event_info_get_event_type", NotificationExGetError(nRet)); - PRINT_RESULT_CALLBACK_NORETURN(NOTI_EX_EVENT_POST, eEventInfoType, "noti_ex_event_info_get_event_type", "Error: Event infor type is not NOTI_EX_EVENT_POST"); - } - - if(EX_EVENT_INFO_GET_OWNER == g_eEventInfoAPI) - { - nRet = noti_ex_event_info_get_owner(hNotiInfo, &pszOwner); - PRINT_RESULT_CALLBACK_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_event_info_get_owner", NotificationExGetError(nRet)); - FREE_MEMORY(pszOwner); - } - - if(EX_EVENT_INFO_GET_CHANNEL == g_eEventInfoAPI) - { - nRet = noti_ex_event_info_get_channel(hNotiInfo, &pszChannel); - PRINT_RESULT_CALLBACK_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_event_info_get_channel", NotificationExGetError(nRet)); - FREE_MEMORY(pszChannel); - } - - if(EX_EVENT_INFO_GET_ITEM_ID == g_eEventInfoAPI) - { - nRet = noti_ex_event_info_get_item_id(hNotiInfo, &pszItemID); - PRINT_RESULT_CALLBACK_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_event_info_get_item_id", NotificationExGetError(nRet)); - FREE_MEMORY(pszItemID); - } - - if(EX_EVENT_INFO_GET_REQUEST_ID == g_eEventInfoAPI) - { - nRet = noti_ex_event_info_get_request_id(hNotiInfo, &nReqID); - PRINT_RESULT_CALLBACK_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_event_info_get_request_id", NotificationExGetError(nRet)); - } - - if(EX_EVENT_INFO_DESTROY == g_eEventInfoAPI) - { - nRet = noti_ex_event_info_destroy(hEventInfo); - PRINT_RESULT_CALLBACK_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_event_info_destroy", NotificationExGetError(nRet)); - } - - nRet = noti_ex_manager_delete_all(g_hEventinfoManager, &nReqID); - PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_manager_delete_all", NotificationExGetError(nRet)); - - g_CallBackHit = true; -} - -void ManagerEventsAddCB(noti_ex_manager_h hManager, noti_ex_event_info_h hEventInfo, noti_ex_item_h *hAddedItem, int nCnt, void *pszData) -{ - g_CallBackHit = true; -#if DEBUG - FPRINTF("[Line : %d][%s] ManagerEventsAddCB Callback Invoked\\n", __LINE__, API_NAMESPACE); -#endif -} - -void ManagerEventsUpdateCB(noti_ex_manager_h hManager, noti_ex_event_info_h hEventInfo, noti_ex_item_h hUpdatedItem, void *pszData) -{ - g_CallBackHit = true; -#if DEBUG - FPRINTF("[Line : %d][%s] ManagerEventsUpdateCB Callback Invoked\\n", __LINE__, API_NAMESPACE); -#endif -} - -void ManagerEventsDeleteCB(noti_ex_manager_h hManager, noti_ex_event_info_h hEventnfo, noti_ex_item_h hDeletedItem, void *pszData) -{ - g_CallBackHit = true; -#if DEBUG - FPRINTF("[Line : %d][%s] ManagerEventsDeleteCB Callback Invoked\\n", __LINE__, API_NAMESPACE); -#endif -} - -void ManagerEventsErrorCB(noti_ex_manager_h hManager, noti_ex_error_e eNotiError, int nReqID, void *pszData) -{ - g_CallBackHit = true; -#if DEBUG - FPRINTF("[Line : %d][%s] ManagerEventsErrorCB Callback Invoked\\n", __LINE__, API_NAMESPACE); -#endif -} - -void GettestEventsAddCB(noti_ex_manager_h hExManager, noti_ex_event_info_h hEventInfo, noti_ex_item_h *hAddedItem, int nCnt, void *pszData) -{ - noti_ex_item_h *hItems; - int nItemsCnt; - int nReqID; - int nRet = NOTI_EX_ERROR_NONE; - - g_bAPIFailed = false; - g_CallBackHit = true; - FPRINTF("[Line : %d][%s] GettestEventsAddCB Callback hit\\n", __LINE__, API_NAMESPACE); - - nRet = noti_ex_manager_get(hExManager, &hItems, &nItemsCnt); - PRINT_RESULT_CALLBACK_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_manager_get", NotificationExGetError(nRet)); - PRINT_RESULT_CALLBACK_NORETURN(1, nItemsCnt, "noti_ex_manager_get", "nItemsCnt is different than 1"); - - nRet = noti_ex_manager_delete_all(g_hExManager, &nReqID); - PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_manager_delete_all", NotificationExGetError(nRet)); -} - -void DeletetestEventsAddCB(noti_ex_manager_h hExManager, noti_ex_event_info_h hEventInfo, noti_ex_item_h *hDeletedItem, int nCnt, void *pszData) -{ - int nReqID; - int nRet = NOTI_EX_ERROR_NONE; - - FPRINTF("[Line : %d][%s] DeletetestEventsAddCB Callback hit\\n", __LINE__, API_NAMESPACE); - g_CallBackHit = true; - g_bAPIFailed = false; - - nRet = noti_ex_manager_delete_all(g_hExManager, &nReqID); - PRINT_RESULT_CALLBACK_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_manager_delete_all", NotificationExGetError(nRet)); -} - -void SendErrorEventsAddCB(noti_ex_manager_h hExManager, noti_ex_event_info_h hEventInfo, noti_ex_item_h *hAddedItem, int nCnt, void *pszData) -{ - int nReqID; - int nRet = NOTI_EX_ERROR_NONE; - - FPRINTF("[Line : %d][%s] SendErrorEventsAddCB Callback hit\\n", __LINE__, API_NAMESPACE); - g_CallBackHit = true; - g_bAPIFailed = false; - - nRet = noti_ex_manager_send_error(g_hExManager, hEventInfo, NOTI_EX_ERROR_INVALID_PARAMETER); - PRINT_RESULT_CALLBACK_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_manager_send_error", NotificationExGetError(nRet)); - - nRet = noti_ex_manager_delete_all(g_hExManager, &nReqID); - PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_manager_delete_all", NotificationExGetError(nRet)); -} - -void ReporterEventsEventCB(noti_ex_reporter_h hExReporter, noti_ex_event_info_h hEventInfo, noti_ex_item_h *hAddedItem, int nCnt, void *pszData) -{ - g_CallBackHit = true; -#if DEBUG - FPRINTF("[Line : %d][%s] ReporterEventsEventCB Callback Invoked\\n", __LINE__, API_NAMESPACE); -#endif -} - -void SendErrorManagerEventsAddCB(noti_ex_manager_h hExManager, noti_ex_event_info_h hEventInfo, noti_ex_item_h *hAddedItem, int nCnt, void *pszData) -{ - int nReqID; - int nRet = NOTI_EX_ERROR_NONE; - - FPRINTF("[Line : %d][%s] SendErrorManagerEventsAddCB Callback hit\\n", __LINE__, API_NAMESPACE); - g_CallBackHit = true; - g_bAPIFailed = false; - - nRet = noti_ex_manager_update(g_hExManager, hAddedItem[0], &nReqID); - PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_manager_update", NotificationExGetError(nRet)); -} - -void SendErrorEventsEventCB(noti_ex_reporter_h hExManager, noti_ex_event_info_h hEventInfo, noti_ex_item_h *hAddedItem, int nCnt, void *pszData) -{ - int nReqID; - int nRet = NOTI_EX_ERROR_NONE; - - FPRINTF("[Line : %d][%s] SendErrorEventsEventCB Callback hit\\n", __LINE__, API_NAMESPACE); - g_CallBackHit = true; - g_bAPIFailed = false; - - nRet = noti_ex_reporter_send_error(g_hEventinfoReporter, hEventInfo, NOTI_EX_ERROR_IO_ERROR); - PRINT_RESULT_CALLBACK_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_reporter_send_error", NotificationExGetError(nRet)); - - nRet = noti_ex_reporter_delete_all(g_hEventinfoReporter, &nReqID); - PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_reporter_delete_all", NotificationExGetError(nRet)); -} - -void PostEventsAddCB(noti_ex_manager_h hExManager, noti_ex_event_info_h hEventInfo, noti_ex_item_h *hAddedItem, int nCnt, void *pszData) -{ - int nReqID; - int nRet = NOTI_EX_ERROR_NONE; - - FPRINTF("[Line : %d][%s] PostEventsAddCB Callback hit\\n", __LINE__, API_NAMESPACE); - g_CallBackHit = true; - - nRet = noti_ex_reporter_delete_all(g_hEventinfoReporter, &nReqID); - PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_reporter_delete_all", NotificationExGetError(nRet)); -} - -void PostEventsListAddCB(noti_ex_manager_h hExManager, noti_ex_event_info_h hEventInfo, noti_ex_item_h *hAddedItem, int nCnt, void *pszData) -{ - int nReqID; - int nRet = NOTI_EX_ERROR_NONE; - - FPRINTF("[Line : %d][%s] PostEventsListAddCB Callback hit\\n", __LINE__, API_NAMESPACE); - g_CallBackHit = true; - - nRet = noti_ex_reporter_delete_all(g_hEventinfoReporter, &nReqID); - PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_reporter_delete_all", NotificationExGetError(nRet)); -} - -void UpdateEventsAddCB(noti_ex_manager_h hExManager, noti_ex_event_info_h hEventInfo, noti_ex_item_h *hAddedItem, int nCnt, void *pszData) -{ - int nReqID; - int nRet = NOTI_EX_ERROR_NONE; - - FPRINTF("[Line : %d][%s] UpdateEventsAddCB Callback hit\\n", __LINE__, API_NAMESPACE); - g_CallBackHit = true; - g_bAPIFailed = false; - - nRet = noti_ex_reporter_update(g_hEventinfoReporter, hAddedItem[0], &nReqID); - PRINT_RESULT_CALLBACK_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_reporter_update", NotificationExGetError(nRet)); - - nRet = noti_ex_reporter_delete_all(g_hEventinfoReporter, &nReqID); - PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_reporter_delete_all", NotificationExGetError(nRet)); -} - -void DeleteEventsAddCB(noti_ex_manager_h hExManager, noti_ex_event_info_h hEventInfo, noti_ex_item_h *hAddedItem, int nCnt, void *pszData) -{ - int nReqID; - int nRet = NOTI_EX_ERROR_NONE; - - FPRINTF("[Line : %d][%s] DeleteEventsAddCB Callback hit\\n", __LINE__, API_NAMESPACE); - g_CallBackHit = true; - g_bAPIFailed = false; - - nRet = noti_ex_reporter_delete(g_hEventinfoReporter, hAddedItem[0], &nReqID); - PRINT_RESULT_CALLBACK_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_reporter_delete", NotificationExGetError(nRet)); -} - -void DeleteallEventsAddCB(noti_ex_manager_h hExManager, noti_ex_event_info_h hEventInfo, noti_ex_item_h *hAddedItem, int nCnt, void *pszData) -{ - int nReqID; - int nRet = NOTI_EX_ERROR_NONE; - - FPRINTF("[Line : %d][%s] DeleteallEventsAddCB Callback hit\\n", __LINE__, API_NAMESPACE); - g_CallBackHit = true; - g_bAPIFailed = false; - - nRet = noti_ex_reporter_delete_all(g_hEventinfoReporter, &nReqID); - PRINT_RESULT_CALLBACK_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_reporter_delete_all", NotificationExGetError(nRet)); -} - -void FindbyrootidEventsAddCB(noti_ex_manager_h hExManager, noti_ex_event_info_h hEventInfo, noti_ex_item_h *hAddedItem, int nCnt, void *pszData) -{ - int nReqID; - int nRet = NOTI_EX_ERROR_NONE; - noti_ex_item_h hItem; - - FPRINTF("[Line : %d][%s] FindbyrootidEventsAddCB Callback hit\\n", __LINE__, API_NAMESPACE); - g_CallBackHit = true; - g_bAPIFailed = false; - - nRet = noti_ex_reporter_find_by_root_id(g_hEventinfoReporter, "testgroup", &hItem); - PRINT_RESULT_CALLBACK_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_reporter_find_by_root_id", NotificationExGetError(nRet)); - - nRet = noti_ex_reporter_delete_all(g_hEventinfoReporter, &nReqID); - PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_reporter_delete_all", NotificationExGetError(nRet)); -} - -/*****************************************************Callback End*****************************************************/ - -/** -* @function ITs_notification_ex_startup -* @description Called before each test -* @parameter NA -* @return NA -*/ -void ITs_notification_ex_startup(void) -{ - struct stat stBuff; - if ( stat(ERR_LOG, &stBuff) == 0 ) - { - remove(ERR_LOG); - } -#if DEBUG - FPRINTF("[Line : %d][%s] TEST SUIT start-up: ITs_notification_ex_startup \\n", __LINE__, API_NAMESPACE); -#endif - return; -} - -/** -* @function ITs_notification_ex_cleanup -* @description Called after each test -* @parameter NA -* @return NA -*/ -void ITs_notification_ex_cleanup(void) -{ -#if DEBUG - FPRINTF("[Line : %d][%s] TEST SUIT clean-up: ITs_notification_ex_cleanup \\n", __LINE__, API_NAMESPACE); -#endif - return; -} - -/** @addtogroup itc-notification-ex-testcases -* @brief Integration testcases for module notification-ex -* @ingroup itc-notification-ex -* @{ -*/ - -//& type : auto -//& purpose: Creates a notification app control. -/** -* @testcase ITc_noti_ex_action_app_control_create_p -* @since_tizen 5.5 -* @author SRID(j.abhishek) -* @reviewer SRID(shobhit.v) -* @type auto -* @description Creates notification-ex app control handler. -* @scenario Create notification\n -* Check return value and also check handle is null or not. -* @apicovered noti_ex_action_app_control_create -* @passcase noti_ex_action_app_control_create is successful and return correct value -* @failcase noti_ex_action_app_control_create gets failed or return null value -* @precondition Create app control and set app id to a dummy app id. -* @postcondition Destroy app control and app control action handler. -*/ -int ITc_noti_ex_action_app_control_create_p(void) -{ - START_TEST; - - int nRet = APP_CONTROL_ERROR_NONE; - app_control_h hAppControl; - noti_ex_action_h hAction = NULL; - - nRet = app_control_create(&hAppControl); - PRINT_RESULT(APP_CONTROL_ERROR_NONE, nRet, "app_control_create", Application_AppControlGetError(nRet)); - CHECK_HANDLE(hAppControl, "app_control_create"); - - const char* pszSetAppID = "org.tizen.app"; //dummy app id - nRet = app_control_set_app_id(hAppControl, pszSetAppID); - PRINT_RESULT_CLEANUP(APP_CONTROL_ERROR_NONE, nRet, "app_control_set_app_id", Application_AppControlGetError(nRet), app_control_destroy(hAppControl)); - - //Target API - nRet = noti_ex_action_app_control_create(&hAction, hAppControl, NULL); - PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_action_app_control_create", NotificationExGetError(nRet), app_control_destroy(hAppControl)); - CHECK_HANDLE_CLEANUP(hAction, "noti_ex_action_app_control_create", app_control_destroy(hAppControl)); - - nRet = app_control_destroy(hAppControl); - PRINT_RESULT_NORETURN(APP_CONTROL_ERROR_NONE, nRet, "app_control_destroy", Application_AppControlGetError(nRet)); - - nRet = noti_ex_action_destroy(hAction); - PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_action_destroy", NotificationExGetError(nRet)); - - return 0; -} - -//& type : auto -//& purpose: Sets and Gets new app control handle from action -/** -* @testcase ITc_noti_ex_action_app_control_set_get_p -* @since_tizen 5.5 -* @author SRID(j.abhishek) -* @reviewer SRID(shobhit.v) -* @type auto -* @description Sets and Gets new app control handle from action. -* @scenario Create notification\n -* Gets new app control from action handler and check for Pass/Fail. -* @apicovered noti_ex_action_app_control_set, noti_ex_action_app_control_get -* @passcase noti_ex_action_app_control_set, noti_ex_action_app_control_get are successful and return correct value -* @failcase noti_ex_action_app_control_set, noti_ex_action_app_control_get gets failed or return null value -* @precondition Create app control and set app id to a dummy app id. -* @postcondition Destroy app control and app control action handler. -*/ -int ITc_noti_ex_action_app_control_set_get_p(void) -{ - START_TEST; - - int nRet = APP_CONTROL_ERROR_NONE; - app_control_h hAppControl; - app_control_h hAppControlSet; - app_control_h hAppControlGet = NULL; - noti_ex_action_h hAction = NULL; - - nRet = app_control_create(&hAppControl); - PRINT_RESULT(APP_CONTROL_ERROR_NONE, nRet, "app_control_create", Application_AppControlGetError(nRet)); - CHECK_HANDLE(hAppControl, "app_control_create"); - - const char* pszSetAppID = "org.tizen.app"; //dummy app id - nRet = app_control_set_app_id(hAppControl, pszSetAppID); - PRINT_RESULT_CLEANUP(APP_CONTROL_ERROR_NONE, nRet, "app_control_set_app_id", Application_AppControlGetError(nRet), app_control_destroy(hAppControl)); - - nRet = noti_ex_action_app_control_create(&hAction, hAppControl, NULL); - PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_action_app_control_create", NotificationExGetError(nRet), app_control_destroy(hAppControl)); - CHECK_HANDLE_CLEANUP(hAction, "noti_ex_action_app_control_creat", app_control_destroy(hAppControl)); - - nRet = app_control_create(&hAppControlSet); - PRINT_RESULT_CLEANUP(APP_CONTROL_ERROR_NONE, nRet, "app_control_create", Application_AppControlGetError(nRet), app_control_destroy(hAppControl); noti_ex_action_destroy(hAction)); - CHECK_HANDLE_CLEANUP(hAppControlSet, "app_control_create", app_control_destroy(hAppControl); noti_ex_action_destroy(hAction)); - - const char* pNewAppID = "org.tizen.newapp"; //dummy app id - nRet = app_control_set_app_id(hAppControlSet, pNewAppID); - PRINT_RESULT_CLEANUP(APP_CONTROL_ERROR_NONE, nRet, "app_control_set_app_id", Application_AppControlGetError(nRet), app_control_destroy(hAppControl); noti_ex_action_destroy(hAction)); - - //Target API - nRet = noti_ex_action_app_control_set(hAction, hAppControlSet); - PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_action_app_control_set", NotificationExGetError(nRet), app_control_destroy(hAppControl); noti_ex_action_destroy(hAction)); - - //Target API - nRet = noti_ex_action_app_control_get(hAction, &hAppControlGet); - PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_action_app_control_get", NotificationExGetError(nRet), app_control_destroy(hAppControl); noti_ex_action_destroy(hAction)); - CHECK_HANDLE_CLEANUP(hAppControlGet, "noti_ex_action_app_control_get", app_control_destroy(hAppControl); noti_ex_action_destroy(hAction)); - - nRet = app_control_destroy(hAppControl); - PRINT_RESULT_NORETURN(APP_CONTROL_ERROR_NONE, nRet, "app_control_destroy", Application_AppControlGetError(nRet)); - - nRet = noti_ex_action_destroy(hAction); - PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_action_destroy", NotificationExGetError(nRet)); - - return 0; -} - -//& type : auto -//& purpose: Creates and delete the notification_ex action handle to control visibility -/** -* @testcase ITc_noti_ex_action_visibility_create_destroy_p -* @since_tizen 5.5 -* @author SRID(j.abhishek) -* @reviewer SRID(shobhit.v) -* @type auto -* @description Creates and delete the notification_ex action handle to control visibility. -* @scenario Creates the notification_ex action handle to control visibility\n -* and delete created handle, check handle for Pass/Fail. -* @apicovered noti_ex_action_visibility_create, noti_ex_action_destroy -* @passcase noti_ex_action_visibility_create, noti_ex_action_destroy is successful and return correct value -* @failcase noti_ex_action_visibility_create, noti_ex_action_destroy failed or return null value -* @precondition NA. -* @postcondition Destroy handle. -*/ -int ITc_noti_ex_action_visibility_create_destroy_p(void) -{ - START_TEST; - - int nRet = NOTI_EX_ERROR_NONE; - noti_ex_action_h hAction = NULL; - const char* pszExtra = "extra"; - - //Target API - nRet = noti_ex_action_visibility_create(&hAction, pszExtra); - PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_action_visibility_create", NotificationExGetError(nRet)); - CHECK_HANDLE(hAction, "noti_ex_action_visibility_create"); - - nRet = noti_ex_action_destroy(hAction); - PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_action_destroy", NotificationExGetError(nRet)); - - return 0; -} - - -//& type : auto -//& purpose: Sets the visibility state for notification_ex item. -/** -* @testcase ITc_noti_ex_action_visibility_set_p -* @since_tizen 5.5 -* @author SRID(j.abhishek) -* @reviewer SRID(shobhit.v) -* @type auto -* @description Sets the visibility state for notification_ex item. -* @scenario Creates the notification_ex action handle to control visibility\n -* Sets the visibility state for notification_ex item and check for Pass/Fail. -* @apicovered noti_ex_action_visibility_set -* @passcase noti_ex_action_visibility_set is successful and return correct value -* @failcase noti_ex_action_visibility_set failed or return null value -* @precondition NA. -* @postcondition Destroy handle. -*/ -int ITc_noti_ex_action_visibility_set_p(void) -{ - START_TEST; - - int nRet = NOTI_EX_ERROR_NONE; - noti_ex_action_h hAction = NULL; - const char* pszExtra = "extra"; - const char* pszID = "textID"; - bool bIsVisible = true; - - nRet = noti_ex_action_visibility_create(&hAction, pszExtra); - PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_action_visibility_create", NotificationExGetError(nRet)); - CHECK_HANDLE(hAction, "noti_ex_action_visibility_create"); - - //Target API - nRet = noti_ex_action_visibility_set(hAction, pszID, bIsVisible); - PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_action_visibility_set", NotificationExGetError(nRet), noti_ex_action_destroy(hAction)); - - nRet = noti_ex_action_destroy(hAction); - PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_action_destroy", NotificationExGetError(nRet)); - - return 0; -} - -//& type : auto -//& purpose: Gets the type of an action. The action type is equal to one of the values of #noti_ex_action_type_e. -/** -* @testcase ITc_noti_ex_action_get_type_p -* @since_tizen 5.5 -* @author SRID(j.abhishek) -* @reviewer SRID(shobhit.v) -* @type auto -* @description Gets the type of an action. The action type is equal to one of the values of #noti_ex_action_type_e. -* @scenario Creates the notification_ex action handle and Gets the type of an action\n -* Check for Pass/Fail. -* @apicovered noti_ex_action_get_type -* @passcase noti_ex_action_get_type is successful and return correct value -* @failcase noti_ex_action_get_type failed or return null value -* @precondition NA. -* @postcondition Destroy handle. -*/ -int ITc_noti_ex_action_get_type_p(void) -{ - START_TEST; - - int nRet = NOTI_EX_ERROR_NONE; - noti_ex_action_h hAction = NULL; - const char* pszExtra = "extra"; - int nType; - - nRet = noti_ex_action_visibility_create(&hAction, pszExtra); - PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_action_visibility_create", NotificationExGetError(nRet)); - CHECK_HANDLE(hAction, "noti_ex_action_visibility_create"); - - //Target API - nRet = noti_ex_action_get_type(hAction, &nType); - PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_action_get_type", NotificationExGetError(nRet), noti_ex_action_destroy(hAction)); - PRINT_RESULT_CLEANUP(NOTI_EX_ACTION_TYPE_VISIBILITY, nType, "noti_ex_action_get_type", "return type of action handle is different", noti_ex_action_destroy(hAction)); - - nRet = noti_ex_action_destroy(hAction); - PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_action_destroy", NotificationExGetError(nRet)); - - return 0; -} - -//& type : auto -//& purpose: Gets the local state of an action. -/** -* @testcase ITc_noti_ex_action_is_local_p -* @since_tizen 5.5 -* @author SRID(j.abhishek) -* @reviewer SRID(shobhit.v) -* @type auto -* @description Gets the local state of an action. -* @scenario Creates the notification_ex action handle and Gets the local state of an action\n -* Check for Pass/Fail. -* @apicovered noti_ex_action_is_local -* @passcase noti_ex_action_is_local is successful and return correct value -* @failcase noti_ex_action_is_local failed or return null value -* @precondition NA. -* @postcondition Destroy handle. -*/ -int ITc_noti_ex_action_is_local_p(void) -{ - START_TEST; - - int nRet = NOTI_EX_ERROR_NONE; - noti_ex_action_h hAction = NULL; - bool bIsLocal = false; - - nRet = noti_ex_action_visibility_create(&hAction, NULL); - PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_action_visibility_create", NotificationExGetError(nRet)); - CHECK_HANDLE(hAction, "noti_ex_action_visibility_create"); - - //Target API - nRet = noti_ex_action_is_local(hAction, &bIsLocal); - PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_action_is_local", NotificationExGetError(nRet), noti_ex_action_destroy(hAction)); - PRINT_RESULT_CLEANUP(true, bIsLocal, "noti_ex_action_is_local", "bIsLocal is not set true", noti_ex_action_destroy(hAction)); - - nRet = noti_ex_action_destroy(hAction); - PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_action_destroy", NotificationExGetError(nRet)); - - return 0; -} - -//& type : auto -//& purpose: Executes the action for a notification_ex item. -/** -* @testcase ITc_noti_ex_action_execute_p -* @since_tizen 5.5 -* @author SRID(j.abhishek) -* @reviewer SRID(shobhit.v) -* @type auto -* @description Executes the action for a notification_ex item. -* @scenario Creates the notification_ex action handle and Executes the action \n -* for a notification_ex item. Check for Pass/Fail. -* @apicovered noti_ex_action_execute -* @passcase noti_ex_action_execute is successful and return correct value -* @failcase noti_ex_action_execute failed or return null value -* @precondition NA. -* @postcondition Destroy handle. -*/ -int ITc_noti_ex_action_execute_p(void) -{ - START_TEST; - - int nRet = NOTI_EX_ERROR_NONE; - noti_ex_action_h hAction = NULL; - - nRet = noti_ex_action_visibility_create(&hAction, NULL); - PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_action_visibility_create", NotificationExGetError(nRet)); - CHECK_HANDLE(hAction, "noti_ex_action_visibility_create"); - - nRet = CreateButton(); - PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_button_create", NotificationExGetError(nRet), noti_ex_action_destroy(hAction)); - CHECK_HANDLE_CLEANUP(g_hItemButton, "noti_ex_item_button_create", noti_ex_action_destroy(hAction)); - - nRet = noti_ex_item_set_action(g_hItemButton, hAction); - PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_set_action", NotificationExGetError(nRet), noti_ex_action_destroy(hAction); noti_ex_item_destroy(g_hItemButton)); - - //Target API - nRet = noti_ex_action_execute(hAction, g_hItemButton); - PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_action_execute", NotificationExGetError(nRet), noti_ex_action_destroy(hAction); noti_ex_item_destroy(g_hItemButton)); - - nRet = noti_ex_action_destroy(hAction); - PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_action_destroy", NotificationExGetError(nRet)); - - return 0; -} - -//& type : auto -//& purpose: Gets the extra data for an action. -/** -* @testcase ITc_noti_ex_action_get_extra_p -* @since_tizen 5.5 -* @author SRID(j.abhishek) -* @reviewer SRID(shobhit.v) -* @type auto -* @description Gets the extra data for an action. -* @scenario Creates the notification_ex action handle and Gets the extra data\n -* for an action. Check for Pass/Fail. -* @apicovered noti_ex_action_get_extra -* @passcase noti_ex_action_get_extra is successful and return correct value -* @failcase noti_ex_action_get_extra failed or return null value -* @precondition NA. -* @postcondition Destroy handle. -*/ -int ITc_noti_ex_action_get_extra_p(void) -{ - START_TEST; - - int nRet = NOTI_EX_ERROR_NONE; - - noti_ex_action_h hAction = NULL; - const char* pszSetExtra = "test"; - char* pszGetExtra = NULL; - - nRet = noti_ex_action_visibility_create(&hAction, pszSetExtra); - PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_action_visibility_create", NotificationExGetError(nRet)); - CHECK_HANDLE(hAction, "noti_ex_action_visibility_create"); - - //Target API - nRet = noti_ex_action_get_extra(hAction, &pszGetExtra); - PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_action_get_extra", NotificationExGetError(nRet), noti_ex_action_destroy(hAction)); - CHECK_HANDLE_CLEANUP(pszGetExtra, "noti_ex_action_get_extra", noti_ex_action_destroy(hAction)); - - if (strncmp(pszSetExtra, pszGetExtra, strlen(pszGetExtra) + 1)) - { - FPRINTF("[Line : %d][%s] noti_ex_action_get_extra: return extra string is different from set extra [%s]\\n", __LINE__, API_NAMESPACE, pszGetExtra); - - nRet = noti_ex_action_destroy(hAction); - PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_action_destroy", NotificationExGetError(nRet)); - - return 1; - } - - nRet = noti_ex_action_destroy(hAction); - PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_action_destroy", NotificationExGetError(nRet)); - - return 0; -} - -//& type : auto -//& purpose: Creates the notification_ex item handle with a button. -/** -* @testcase ITc_noti_ex_item_button_create_p -* @since_tizen 5.5 -* @author SRID(j.abhishek) -* @reviewer SRID(shobhit.v) -* @type auto -* @description Creates the notification_ex item handle with a button. -* @scenario Creates the notification_ex item handle with a button \n -* Check for Pass/Fail. -* @apicovered noti_ex_item_button_create -* @passcase noti_ex_item_button_create is successful and return correct value -* @failcase noti_ex_item_button_create failed or return null value -* @precondition NA. -* @postcondition Destroy handle. -*/ -int ITc_noti_ex_item_button_create_p(void) -{ - START_TEST; - - int nRet = NOTI_EX_ERROR_NONE; - - //Taregt API - nRet = CreateButton(); - PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_button_create", NotificationExGetError(nRet)); - CHECK_HANDLE(g_hItemButton, "noti_ex_item_button_create"); - - nRet = noti_ex_item_destroy(g_hItemButton); - PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_destroy", NotificationExGetError(nRet)); - - return 0; -} - -//& type : auto -//& purpose: Gets the title of a button item. -/** -* @testcase ITc_noti_ex_item_button_get_title_p -* @since_tizen 5.5 -* @author SRID(j.abhishek) -* @reviewer SRID(shobhit.v) -* @type auto -* @description Gets the title of a button item. -* @scenario Creates the notification_ex item handle with a button \n -* Gets the title and compare with Set title. Check for Pass/Fail. -* @apicovered noti_ex_item_button_get_title -* @passcase noti_ex_item_button_get_title is successful and return correct value -* @failcase noti_ex_item_button_get_title failed or return null value -* @precondition NA. -* @postcondition Free Title pointer memory and destroy handle. -*/ -int ITc_noti_ex_item_button_get_title_p(void) -{ - START_TEST; - - int nRet = NOTI_EX_ERROR_NONE; - char* pszGetTitle = NULL; - - nRet = CreateButton(); - PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_button_create", NotificationExGetError(nRet)); - CHECK_HANDLE(g_hItemButton, "noti_ex_item_button_create"); - - //Taregt API - nRet = noti_ex_item_button_get_title(g_hItemButton, &pszGetTitle); - PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_button_get_title", NotificationExGetError(nRet), noti_ex_item_destroy(g_hItemButton)); - CHECK_HANDLE_CLEANUP(pszGetTitle, "noti_ex_item_button_get_title", noti_ex_item_destroy(g_hItemButton)); - - if (strncmp(g_pszButtonTitle, pszGetTitle, strlen(pszGetTitle) + 1)) - { - FPRINTF("[Line : %d][%s] noti_ex_item_button_get_title: return title is different from set title [%s]\\n", __LINE__, API_NAMESPACE, pszGetTitle); - FREE_MEMORY(pszGetTitle); - - nRet = noti_ex_item_destroy(g_hItemButton); - PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_destroy", NotificationExGetError(nRet)); - - return 1; - } - - FREE_MEMORY(pszGetTitle); - - nRet = noti_ex_item_destroy(g_hItemButton); - PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_destroy", NotificationExGetError(nRet)); - - return 0; -} - -//& type : auto -//& purpose: Creates the notification_ex item handle for the chat message. -/** -* @testcase ITc_noti_ex_item_chat_message_create_p -* @since_tizen 5.5 -* @author SRID(j.abhishek) -* @reviewer SRID(shobhit.v) -* @type auto -* @description Creates the notification_ex item handle for the chat message. -* @scenario Creates the notification_ex item handle for the chat message \n -* Check for handle and check for Pass/Fail. -* @apicovered noti_ex_item_chat_message_create -* @passcase noti_ex_item_chat_message_create is successful and return correct value -* @failcase noti_ex_item_chat_message_create failed or return null value -* @precondition Name, Text and Image must be created before creating chat message. -* @postcondition Free Title pointer memory and destroy handle. -*/ -int ITc_noti_ex_item_chat_message_create_p(void) -{ - START_TEST; - - int nRet = NOTI_EX_ERROR_NONE; - noti_ex_item_h hItemChatMsg = NULL; - - nRet = CreateChatMsgAttributes(); - if(nRet) - { - FPRINTF("[Line : %d][%s] One of the API inside CreateChatMsgAttributes() is failed \\n", __LINE__, API_NAMESPACE); - return 1; - } - - noti_ex_item_chat_message_type_e eChatMsgType[] = { - NOTI_EX_ITEM_CHAT_MESSAGE_TYPE_USER, - NOTI_EX_ITEM_CHAT_MESSAGE_TYPE_SENDER - }; - - int nEnumSize = sizeof(eChatMsgType) / sizeof(eChatMsgType[0]); - int nEnumCounter; - - for ( nEnumCounter=0; nEnumCounter