From: Nibha Sharma Date: Tue, 13 Oct 2020 06:22:48 +0000 (+0530) Subject: [ITC][notification/bundle][NonACR][print cleanup moodify/added] X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F07%2F245607%2F4;p=test%2Ftct%2Fnative%2Fapi.git [ITC][notification/bundle][NonACR][print cleanup moodify/added] Change-Id: I74dd1a1c75a51446e4e7aad64849aaca82f88652 Signed-off-by: Nibha Sharma --- diff --git a/src/itc/bundle/ITs-bundle-common.h b/src/itc/bundle/ITs-bundle-common.h index 106ff65fe..b6fb51717 100755 --- a/src/itc/bundle/ITs-bundle-common.h +++ b/src/itc/bundle/ITs-bundle-common.h @@ -41,6 +41,15 @@ }\ } +#define CHECK_HANDLE_CLEANUP(Handle, API, FreeResource) {\ + if ( Handle == NULL )\ +{\ + FPRINTF("[Line : %d][%s] %s failed, error returned = Handle returned is NULL\\n", __LINE__, API_NAMESPACE, API);\ + FreeResource;\ + return 1;\ +}\ +} + /** * @function BundleGetType * @description Maps Types of given values to string. diff --git a/src/itc/bundle/ITs-bundle.c b/src/itc/bundle/ITs-bundle.c index 7d0a4787e..9882c1702 100755 --- a/src/itc/bundle/ITs-bundle.c +++ b/src/itc/bundle/ITs-bundle.c @@ -171,11 +171,11 @@ int ITc_bundle_encode_decode_p(void) { char* pTempBundleStr = NULL; nRetVal = bundle_get_str(tempBundle, (char *)KEY1, &pTempBundleStr); - PRINT_RESULT(BUNDLE_ERROR_NONE, nRetVal, "bundle_get_str", BundleGetError(nRetVal)); - CHECK_HANDLE(pTempBundleStr,"bundle_get_str"); + PRINT_RESULT_CLEANUP(BUNDLE_ERROR_NONE, nRetVal, "bundle_get_str", BundleGetError(nRetVal), FREE_MEMORY(pstBundleRaw);bundle_free(tempBundle)); + CHECK_HANDLE_CLEANUP(pTempBundleStr,"bundle_get_str",FREE_MEMORY(pstBundleRaw);bundle_free(tempBundle)); if ( strcmp((char *)KEY1_VALUE, pTempBundleStr) != 0 )//not equal { - FPRINTF("[Line : %d][%s] bundle_decode failed, error returned = %s\\n", __LINE__, API_NAMESPACE, BundleGetError(nRetVal)); + FPRINTF("[Line : %d][%s] bundle_get_str failed, error returned = %s\\n", __LINE__, API_NAMESPACE, BundleGetError(nRetVal)); FREE_MEMORY(pstBundleRaw); bundle_free(tempBundle); return 1; diff --git a/src/itc/notification/ITs-notification.c b/src/itc/notification/ITs-notification.c index 4e58acda4..418da43a7 100755 --- a/src/itc/notification/ITs-notification.c +++ b/src/itc/notification/ITs-notification.c @@ -1738,10 +1738,10 @@ int ITc_notification_set_get_auto_remove_p(void) eRetNotiErr = notification_set_auto_remove(g_NotificationHandle, bSetAutoRmv); PRINT_RESULT_CLEANUP(NOTIFICATION_ERROR_NONE, eRetNotiErr, "notification_set_auto_remove", NotificationGetError(eRetNotiErr), FreeAndDeleteNotificationResourceHandle()); - eRetNotiErr = notification_get_auto_remove(g_NotificationHandle, &bGetAutoRmv); + eRetNotiErr = notification_get_auto_remove(g_NotificationHandle, &bGetAutoRmv); PRINT_RESULT_CLEANUP(NOTIFICATION_ERROR_NONE, eRetNotiErr, "notification_get_auto_remove", NotificationGetError(eRetNotiErr), FreeAndDeleteNotificationResourceHandle()); - if ( bGetAutoRmv != false ) + if ( bGetAutoRmv != bSetAutoRmv ) { FPRINTF("[Line : %d][%s] set and get auto remove mis-match occurs, set auto remove = %d, get auto remove = %d\\n", __LINE__, API_NAMESPACE, bSetAutoRmv, bGetAutoRmv); FreeAndDeleteNotificationResourceHandle(); @@ -1857,16 +1857,16 @@ int ITc_notification_set_text_input_p(void) char* pSetAppID = "org.tizen.app"; //dummy app id notification_h hNotification; app_control_h hAppControl; - + hNotification = notification_create(NOTIFICATION_TYPE_NOTI); CHECK_HANDLE(hNotification, "notification_create"); int nRet = notification_set_text_input(hNotification, 160); PRINT_RESULT_CLEANUP(NOTIFICATION_ERROR_NONE, nRet, "notification_set_text_input", NotificationGetError(nRet),FREE_MEMORY(hNotification)); - + nRet = notification_set_text(hNotification, NOTIFICATION_TEXT_TYPE_TEXT_INPUT_PLACEHOLDER, "I'm Title", "TITLE", NOTIFICATION_VARIABLE_TYPE_NONE); PRINT_RESULT_CLEANUP(NOTIFICATION_ERROR_NONE, nRet, "notification_set_text", NotificationGetError(nRet),FREE_MEMORY(hNotification)); - + nRet = notification_set_text(hNotification, NOTIFICATION_TEXT_TYPE_TEXT_INPUT_BUTTON, "I'm Title", "TITLE", NOTIFICATION_VARIABLE_TYPE_NONE); PRINT_RESULT_CLEANUP(NOTIFICATION_ERROR_NONE, nRet, "notification_set_text", NotificationGetError(nRet),FREE_MEMORY(hNotification)); @@ -1875,23 +1875,24 @@ int ITc_notification_set_text_input_p(void) if(NULL == hAppControl) { FPRINTF("[Line : %d][%s]app_control_create returned NULL handle value\\n", __LINE__, API_NAMESPACE); + FREE_MEMORY(hNotification); return 1; } nRet = app_control_set_app_id(hAppControl, pSetAppID); - PRINT_RESULT_CLEANUP(APP_CONTROL_ERROR_NONE, nRet, "app_control_set_app_id", Application_AppControlGetError(nRet), app_control_destroy(hAppControl);); + PRINT_RESULT_CLEANUP(APP_CONTROL_ERROR_NONE, nRet, "app_control_set_app_id", Application_AppControlGetError(nRet), FREE_MEMORY(hNotification);app_control_destroy(hAppControl)); nRet = app_control_set_operation(hAppControl, APP_CONTROL_OPERATION_DEFAULT); - PRINT_RESULT_CLEANUP(APP_CONTROL_ERROR_NONE, nRet, "app_control_set_operation", Application_AppControlGetError(nRet), app_control_destroy(hAppControl);); + PRINT_RESULT_CLEANUP(APP_CONTROL_ERROR_NONE, nRet, "app_control_set_operation", Application_AppControlGetError(nRet), FREE_MEMORY(hNotification);app_control_destroy(hAppControl);); nRet = notification_set_event_handler(hNotification, NOTIFICATION_EVENT_TYPE_CLICK_ON_TEXT_INPUT_BUTTON, hAppControl); - PRINT_RESULT_CLEANUP(NOTIFICATION_ERROR_NONE, nRet, "notification_set_event_handler", NotificationGetError(nRet), FreeAndDeleteNotificationResourceHandle();app_control_destroy(hAppControl);); + PRINT_RESULT_CLEANUP(NOTIFICATION_ERROR_NONE, nRet, "notification_set_event_handler", NotificationGetError(nRet), FreeAndDeleteNotificationResourceHandle();FREE_MEMORY(hNotification);app_control_destroy(hAppControl);); nRet = app_control_destroy(hAppControl); - PRINT_RESULT(APP_CONTROL_ERROR_NONE, nRet, "app_control_destroy", Application_AppControlGetError(nRet)); + PRINT_RESULT_CLEANUP(APP_CONTROL_ERROR_NONE, nRet, "app_control_destroy", Application_AppControlGetError(nRet),FREE_MEMORY(hNotification)); nRet = notification_post(hNotification); - PRINT_RESULT(APP_CONTROL_ERROR_NONE, nRet, "notification_post", Application_AppControlGetError(nRet)); + PRINT_RESULT_NORETURN(APP_CONTROL_ERROR_NONE, nRet, "notification_post", Application_AppControlGetError(nRet)); FREE_MEMORY(hNotification); return 0;