return -1;
}
+/**
+ * @function ShortcutRemoveCb
+ * @description Callback function
+ * @parameter const char *package_name, const char *name, int sender_pid, void *user_data
+ * @return int
+ */
+static int ShortcutRemoveCb(const char *package_name, const char *name, int sender_pid, void *user_data)
+{
+ g_bCallbackHitRemoveCb = true;
+ FPRINTF("[Line : %d][%s] Inside ShortcutRemoveCb callback function\\n", __LINE__, API_NAMESPACE);
+ QUIT_GMAIN_LOOP;
+ return 0;
+}
+
+/**
+ * @function ShortcutRemoveFromHomeCB
+ * @description Callback function
+ * @parameter int ret, void *data
+ * @return int
+ */
+static int ShortcutRemoveFromHomeCB(int ret, void *data)
+{
+ FPRINTF("[Line : %d][%s] ShortcutRemoveFromHomeCB callback called\\n", __LINE__, API_NAMESPACE);
+ if ( ret < 0 )
+ {
+ FPRINTF("[Line : %d][%s] Failed to remove shortcut : %s\\n", __LINE__, API_NAMESPACE, strerror(errno));
+ QUIT_GMAIN_LOOP;
+ return 0;
+ }
+
+ QUIT_GMAIN_LOOP
+ return 0;
+}
/**********************************************************CallBack End**********************************************************/
nRet = shortcut_add_to_home(pszName, LAUNCH_BY_APP, TEST_SHORTCUT_APPID, g_pszICON_PATH, DUPLICATEALLOWED, ShortcutAddToHomeCB, TESTSTRING);
RUN_POLLING_LOOP;
- PRINT_RESULT(SHORTCUT_ERROR_NONE, nRet, "shortcut_add_to_home", ShortcutError(nRet));
+ PRINT_RESULT_CLEANUP(SHORTCUT_ERROR_NONE, nRet, "shortcut_add_to_home", ShortcutError(nRet), shortcut_unset_request_cb());
CHECK_CALLBACK_STATUS("shortcut_add_to_home", g_bCallbackHit, g_bRequestCBCallbackHit);
+ shortcut_unset_request_cb();
return 0;
}
nRet = shortcut_add_to_home_widget(pszName, eShortcutWidgetSize[enum_counter1], TEST_SHORTCUT_APPID, g_pszICON_PATH, SHORTCUTPERIOD, DUPLICATEALLOWED, ShortcutAddToHomeWidgetCB, TESTSTRING);
RUN_POLLING_LOOP;
- PRINT_RESULT(SHORTCUT_ERROR_NONE, nRet, "shortcut_add_to_home_widget", ShortcutError(nRet));
+ PRINT_RESULT_CLEANUP(SHORTCUT_ERROR_NONE, nRet, "shortcut_add_to_home_widget", ShortcutError(nRet), shortcut_unset_request_cb());
CHECK_CALLBACK_STATUS("shortcut_add_to_home_widget", g_bCallbackHit, g_bRequestCBCallbackHit);
+ shortcut_unset_request_cb();
}
return 0;
//& purpose: Test shortcut_set_request_cb
//& type: auto
-int ITc_shortcut_set_request_cb_p(void)
+int ITc_shortcut_set_unset_request_cb_p(void)
{
START_TEST;
g_b2CallbackValueCheck = true;
nRet = shortcut_add_to_home(pszName, LAUNCH_BY_APP, TEST_SHORTCUT_APPID, g_pszICON_PATH, DUPLICATEALLOWED, ShortcutAddToHomeCB, TESTSTRING);
RUN_POLLING_LOOP;
- PRINT_RESULT(SHORTCUT_ERROR_NONE, nRet, "shortcut_add_to_home", ShortcutError(nRet));
+ PRINT_RESULT_CLEANUP(SHORTCUT_ERROR_NONE, nRet, "shortcut_add_to_home", ShortcutError(nRet), shortcut_unset_request_cb());
CHECK_CALLBACK_STATUS("shortcut_set_request_cb", g_bCallbackHit, g_bRequestCBCallbackHit);
+ shortcut_unset_request_cb();
return 0;
}
return 0;
}
+/**
+* @testcase ITc_shortcut_set_unset_remove_cb_p
+* @since_tizen 3.0
+* @author SRID(a.pandia1)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Registers and unregisters the callback function to listen the remove requests from applications
+* @scenario Call shortcut_set_remove_cb, shortcut_unset_remove_cb
+* @apicovered shortcut_set_remove_cb, shortcut_unset_remove_cb
+* @passcase If target API returns SHORTCUT_ERROR_NONE
+* @failcase If API fails to complete the scenario cycle
+* @precondition Prepare the callback function
+* @postcondition You have to check the return status from the callback function which is passed by the argument.
+*/
+//& purpose: Registers and unregisters the callback function to listen the remove requests from applications
+//& type: auto
+
+int ITc_shortcut_set_unset_remove_cb_p(void)
+{
+ START_TEST;
+ g_b2CallbackValueCheck = true;
+
+ int nRet = -1;
+ char *pszName = "Test";
+
+ g_bCallbackHit = false;
+ g_bRequestCBCallbackHit = false;
+
+ nRet = shortcut_set_request_cb(ShortcutRequestCB, TESTSTRING);
+ PRINT_RESULT(SHORTCUT_ERROR_NONE, nRet, "shortcut_set_request_cb", ShortcutError(nRet));
+
+ nRet = shortcut_add_to_home(pszName, LAUNCH_BY_APP, TEST_SHORTCUT_APPID, g_pszICON_PATH, DUPLICATEALLOWED, ShortcutAddToHomeCB, TESTSTRING);
+ RUN_POLLING_LOOP;
+ PRINT_RESULT_CLEANUP(SHORTCUT_ERROR_NONE, nRet, "shortcut_add_to_home", ShortcutError(nRet), shortcut_unset_request_cb());
+ CHECK_CALLBACK_STATUS("shortcut_set_request_cb", g_bCallbackHit, g_bRequestCBCallbackHit);
+
+ g_bCallbackHitRemoveCb = false;
+ // Target API
+ nRet = shortcut_set_remove_cb(ShortcutRemoveCb, NULL);
+ PRINT_RESULT_CLEANUP(SHORTCUT_ERROR_NONE, nRet, "shortcut_set_remove_cb", ShortcutError(nRet), shortcut_unset_request_cb());
+
+ // Callback Triggering API
+ nRet = shortcut_remove_from_home(pszName, ShortcutRemoveFromHomeCB, NULL);
+ PRINT_RESULT_CLEANUP(SHORTCUT_ERROR_NONE, nRet, "shortcut_remove_from_home", ShortcutError(nRet), shortcut_unset_remove_cb();shortcut_unset_request_cb());
+
+ RUN_POLLING_LOOP;
+ if(!g_bCallbackHitRemoveCb)
+ {
+ FPRINTF("[Line : %d][%s] Failed to hit callback ShortcutRemoveCb\\n", __LINE__, API_NAMESPACE);
+ shortcut_unset_remove_cb();
+ shortcut_unset_request_cb();
+ return 1;
+ }
+
+ // Target API
+ shortcut_unset_remove_cb();
+
+ shortcut_unset_request_cb();
+ return 0;
+}
/** @} */
/** @} */
extern int ITc_shortcut_add_to_home_p(void);
extern int ITc_shortcut_add_to_home_widget_p(void);
-extern int ITc_shortcut_set_request_cb_p(void);
+extern int ITc_shortcut_set_unset_request_cb_p(void);
extern int ITc_shortcut_get_list_p(void);
+extern int ITc_shortcut_set_unset_remove_cb_p(void);
testcase tc_array[] = {
{"ITc_shortcut_add_to_home_p", ITc_shortcut_add_to_home_p, ITs_shortcut_startup, ITs_shortcut_cleanup},
{"ITc_shortcut_add_to_home_widget_p", ITc_shortcut_add_to_home_widget_p, ITs_shortcut_startup, ITs_shortcut_cleanup},
- {"ITc_shortcut_set_request_cb_p", ITc_shortcut_set_request_cb_p, ITs_shortcut_startup, ITs_shortcut_cleanup},
+ {"ITc_shortcut_set_unset_request_cb_p", ITc_shortcut_set_unset_request_cb_p, ITs_shortcut_startup, ITs_shortcut_cleanup},
{"ITc_shortcut_get_list_p", ITc_shortcut_get_list_p, ITs_shortcut_startup, ITs_shortcut_cleanup},
+ {"ITc_shortcut_set_unset_remove_cb_p", ITc_shortcut_set_unset_remove_cb_p, ITs_shortcut_startup, ITs_shortcut_cleanup},
{NULL, NULL}
};