From dff6406645d62a6ee77e11e7fc18de208a0227aa Mon Sep 17 00:00:00 2001 From: Shashank Shekhar Shukla Date: Tue, 12 Jul 2016 11:05:08 +0900 Subject: [PATCH] [ITC][stt][DPTTIZEN-2171][Fix TC logic according to developer comments] Change-Id: Ife87264d397f34b52ed565ba1570a89946ef5cd5 Signed-off-by: Shashank Shekhar Shukla --- src/itc/stt/ITs-stt.c | 89 ++--------------------------------- src/itc/stt/tct-stt-native_mobile.h | 2 - src/itc/stt/tct-stt-native_tv.h | 2 - src/itc/stt/tct-stt-native_wearable.h | 2 - 4 files changed, 3 insertions(+), 92 deletions(-) diff --git a/src/itc/stt/ITs-stt.c b/src/itc/stt/ITs-stt.c index 5e5b341..4f35391 100755 --- a/src/itc/stt/ITs-stt.c +++ b/src/itc/stt/ITs-stt.c @@ -718,20 +718,11 @@ bool sttEngineChangedcb(stt_h stt, const char* engine_id, const char* language, #if DEBUG FPRINTF("[Line : %d][%s] Reached sttEngineChangedcb\\n", __LINE__, API_NAMESPACE); #endif - - g_CallBackHit = true; if(stt == NULL) { FPRINTF("[Line : %d][%s] Handle is NULL in callback function\\n", __LINE__, API_NAMESPACE); } - - if ( g_pMainLoop ) - { - g_main_loop_quit(g_pMainLoop); - g_main_loop_unref(g_pMainLoop); - g_pMainLoop = NULL; - } return true; } @@ -2819,13 +2810,7 @@ int ITc_stt_set_get_private_data_p(void) nRet = stt_get_private_data(g_hStt,"test",&Getdata); PRINT_RESULT_CLEANUP(STT_ERROR_NONE, nRet, "stt_get_private_data", SttGetError(nRet), stt_unprepare(g_hStt);FREE_MEMORY(Getdata)); - if( 0 != strcmp("data",Getdata) ) - { - FPRINTF("[Line : %d][%s] get data is not matched \\n", __LINE__, API_NAMESPACE); - FREE_MEMORY(Getdata); - stt_unprepare(g_hStt); - return 1; - } + /*According to the developer, it is unnecessary to compare the key and result as stt_set_private_data() is for setting the key and not saving.*/ FREE_MEMORY(Getdata); nRet = stt_unprepare(g_hStt); @@ -2836,68 +2821,6 @@ int ITc_stt_set_get_private_data_p(void) //& type: auto //& purpose: To get the list of supported voices. /** -* @testcase ITc_stt_get_error_message_p -* @since_tizen 3.0 -* @author SRID(asit.s) -* @reviewer SRID(a.pandia1) -* @type auto -* @scenario create a stt handler\n -* call stt_set_error_cb to register callback function\n -* call stt_set_credential with NULL parameters to generate error\n -* call stt_get_error_message to get error. -* @apicovered stt_set_credential,stt_set_error_cb,stt_get_error_message. -* @passcase if API is successful -* @failcase if API is not successful -* @precondition NA -* @postcondition NA -*/ -int ITc_stt_get_error_message_p(void) -{ - START_TEST; - - char* err_msg = NULL; - stt_state_e state; - int nIotconTimeoutId = 0; - - int nRet = stt_get_state(g_hStt, &state); - PRINT_RESULT(STT_ERROR_NONE, nRet, "stt_get_state", SttGetError(nRet)); - - if(state != STT_STATE_CREATED) - { - FPRINTF("[Line : %d][%s] get state is not matched \\n", __LINE__, API_NAMESPACE); - return 1; - } - - nRet = stt_set_error_cb(g_hStt, sttErrorCallback, NULL); - PRINT_RESULT(STT_ERROR_NONE, nRet, "stt_set_error_cb", SttGetError(nRet)); - - //This API called for generating error - nRet = stt_set_credential(NULL,NULL); - PRINT_RESULT_NORETURN(STT_ERROR_NONE,nRet,"stt_set_credential",SttGetError(nRet)); - - RUN_POLLING_LOOP; - if(g_CallBackHit != true) - { - FPRINTF("[Line : %d][%s] callback hit failed \\n", __LINE__, API_NAMESPACE); - stt_unset_error_cb(g_hStt); - return 1; - } - - nRet = stt_get_error_message(g_hStt, &err_msg); - PRINT_RESULT_CLEANUP(STT_ERROR_NONE,nRet,"stt_get_error_message",SttGetError(nRet),stt_unset_error_cb(g_hStt);FREE_MEMORY(err_msg)); - CHECK_HANDLE(err_msg, "stt_get_error_message"); - FREE_MEMORY(err_msg); - - nRet = stt_unset_error_cb(g_hStt); - PRINT_RESULT_NORETURN(STT_ERROR_NONE, nRet, "stt_unset_error_cb", SttGetError(nRet)); - - return 0; -} - - -//& type: auto -//& purpose: To get the list of supported voices. -/** * @testcase ITc_stt_set_unset_engine_changed_cb_p * @since_tizen 3.0 * @author SRID(asit.s) @@ -2915,18 +2838,12 @@ int ITc_stt_get_error_message_p(void) int ITc_stt_set_unset_engine_changed_cb_p(void) { START_TEST; - int nIotconTimeoutId = 0; g_CallBackHit = false; int nRet = stt_set_engine_changed_cb(g_hStt,sttEngineChangedcb,NULL); PRINT_RESULT(STT_ERROR_NONE, nRet, "stt_set_engine_changed_cb", SttGetError(nRet)); - - RUN_POLLING_LOOP; - if(g_CallBackHit != true) - { - FPRINTF("[Line : %d][%s] callback hit failed \\n", __LINE__, API_NAMESPACE); - return 1; - } + + /*According to the developer, it is impossible to change the STT Engine in the situation and hence callback cannot be checked.*/ nRet = stt_unset_engine_changed_cb(g_hStt); PRINT_RESULT(STT_ERROR_NONE, nRet, "stt_unset_engine_changed_cb", SttGetError(nRet)); diff --git a/src/itc/stt/tct-stt-native_mobile.h b/src/itc/stt/tct-stt-native_mobile.h index f06e225..6650920 100755 --- a/src/itc/stt/tct-stt-native_mobile.h +++ b/src/itc/stt/tct-stt-native_mobile.h @@ -44,7 +44,6 @@ extern int ITc_stt_foreach_supported_engines_p(void); extern int ITc_stt_foreach_supported_languages_p(void); extern int ITc_stt_set_credential_p(void); extern int ITc_stt_set_get_private_data_p(void); -extern int ITc_stt_get_error_message_p(void); extern int ITc_stt_set_unset_engine_changed_cb_p(void); testcase tc_array[] = { @@ -70,7 +69,6 @@ testcase tc_array[] = { {"ITc_stt_foreach_supported_languages_p", ITc_stt_foreach_supported_languages_p, ITs_stt_startup, ITs_stt_cleanup}, {"ITc_stt_set_credential_p", ITc_stt_set_credential_p, ITs_stt_startup, ITs_stt_cleanup}, {"ITc_stt_set_get_private_data_p", ITc_stt_set_get_private_data_p, ITs_stt_startup, ITs_stt_cleanup}, - {"ITc_stt_get_error_message_p", ITc_stt_get_error_message_p, ITs_stt_startup, ITs_stt_cleanup}, {"ITc_stt_set_unset_engine_changed_cb_p", ITc_stt_set_unset_engine_changed_cb_p, ITs_stt_startup, ITs_stt_cleanup}, {NULL, NULL} }; diff --git a/src/itc/stt/tct-stt-native_tv.h b/src/itc/stt/tct-stt-native_tv.h index 0c25ccc..140e113 100755 --- a/src/itc/stt/tct-stt-native_tv.h +++ b/src/itc/stt/tct-stt-native_tv.h @@ -43,7 +43,6 @@ extern int ITc_stt_foreach_supported_engines_p(void); extern int ITc_stt_foreach_supported_languages_p(void); extern int ITc_stt_set_credential_p(void); extern int ITc_stt_set_get_private_data_p(void); -extern int ITc_stt_get_error_message_p(void); extern int ITc_stt_set_unset_engine_changed_cb_p(void); testcase tc_array[] = { @@ -69,7 +68,6 @@ testcase tc_array[] = { {"ITc_stt_foreach_supported_languages_p", ITc_stt_foreach_supported_languages_p, ITs_stt_startup, ITs_stt_cleanup}, {"ITc_stt_set_credential_p", ITc_stt_set_credential_p, ITs_stt_startup, ITs_stt_cleanup}, {"ITc_stt_set_get_private_data_p", ITc_stt_set_get_private_data_p, ITs_stt_startup, ITs_stt_cleanup}, - {"ITc_stt_get_error_message_p", ITc_stt_get_error_message_p, ITs_stt_startup, ITs_stt_cleanup}, {"ITc_stt_set_unset_engine_changed_cb_p", ITc_stt_set_unset_engine_changed_cb_p, ITs_stt_startup, ITs_stt_cleanup}, {NULL, NULL} }; diff --git a/src/itc/stt/tct-stt-native_wearable.h b/src/itc/stt/tct-stt-native_wearable.h index f06e225..6650920 100755 --- a/src/itc/stt/tct-stt-native_wearable.h +++ b/src/itc/stt/tct-stt-native_wearable.h @@ -44,7 +44,6 @@ extern int ITc_stt_foreach_supported_engines_p(void); extern int ITc_stt_foreach_supported_languages_p(void); extern int ITc_stt_set_credential_p(void); extern int ITc_stt_set_get_private_data_p(void); -extern int ITc_stt_get_error_message_p(void); extern int ITc_stt_set_unset_engine_changed_cb_p(void); testcase tc_array[] = { @@ -70,7 +69,6 @@ testcase tc_array[] = { {"ITc_stt_foreach_supported_languages_p", ITc_stt_foreach_supported_languages_p, ITs_stt_startup, ITs_stt_cleanup}, {"ITc_stt_set_credential_p", ITc_stt_set_credential_p, ITs_stt_startup, ITs_stt_cleanup}, {"ITc_stt_set_get_private_data_p", ITc_stt_set_get_private_data_p, ITs_stt_startup, ITs_stt_cleanup}, - {"ITc_stt_get_error_message_p", ITc_stt_get_error_message_p, ITs_stt_startup, ITs_stt_cleanup}, {"ITc_stt_set_unset_engine_changed_cb_p", ITc_stt_set_unset_engine_changed_cb_p, ITs_stt_startup, ITs_stt_cleanup}, {NULL, NULL} }; -- 2.7.4