[ITC][capi-ui-inputmethod][ACR-1611][Added TCs for new APIs] 56/253456/3
authorABHISHEK JAIN <j.abhishek@samsung.com>
Wed, 10 Feb 2021 08:13:21 +0000 (13:43 +0530)
committershobhit verma <shobhit.v@samsung.com>
Fri, 12 Feb 2021 08:00:34 +0000 (08:00 +0000)
Change-Id: I55701337b68c0904f5bf673f6cc89e1e484aa949
Signed-off-by: ABHISHEK JAIN <j.abhishek@samsung.com>
src/itc/capi-ui-inputmethod/ITs-capi-ui-inputmethod-common.c
src/itc/capi-ui-inputmethod/ITs-capi-ui-inputmethod-common.h
src/itc/capi-ui-inputmethod/ITs-capi-ui-inputmethod.c
src/itc/capi-ui-inputmethod/tct-capi-ui-inputmethod-native_mobile.h
src/itc/capi-ui-inputmethod/tct-capi-ui-inputmethod-native_tizeniot.h
src/itc/capi-ui-inputmethod/tct-capi-ui-inputmethod-native_tv.h
src/itc/capi-ui-inputmethod/tct-capi-ui-inputmethod-native_wearable.h

index 47c7f51acfb5051b0c8f839f443edab63dcbfe8b..2e01fa13dbdff3197acbcc790e8d94effbb8633b 100755 (executable)
@@ -39,4 +39,25 @@ char* InputGetError(int nRet)
        return szErrorVal;
 }
 
+static void WinDel(void *data, Evas_Object *obj, void *event)
+{
+       elm_exit();
+}
+
+Evas_Object* CreateNormalWin()
+{
+       Evas_Object *eo = NULL;
+
+       eo = elm_win_add(NULL, "IME Window", ELM_WIN_BASIC);
+       if (eo)
+       {
+               elm_win_title_set(eo, "IME Window");
+               elm_win_borderless_set(eo, EINA_TRUE);
+               evas_object_smart_callback_add(eo, "delete,request",WinDel, NULL);
+               elm_win_indicator_mode_set(eo, ELM_WIN_INDICATOR_SHOW);
+       }
+
+       return eo;
+}
+
 /** @} */
index 28df382c381acaf930af90b537020c2e277a2690..562d0bfefee9a467ce286928f5064b9c3a8559db 100755 (executable)
@@ -37,7 +37,9 @@
 char* InputGetError(int nRet);
 int g_nRet;
 bool g_bCallbackCalled;
+bool g_bSupportAPIFailed;
 typedef void (*void_f)(void);
+Evas_Object* CreateNormalWin(void);
 
 /** @} */
 #endif  //_ITS_CAPI_UI_INPUTMETHOD_COMMON_H_
index 993c355a73ad72051d612906795a1c43935ada59..54f7fe793e3ecd6f72c9a5ba3081b6912c64d25c 100755 (executable)
@@ -273,6 +273,126 @@ static void InputMethodEventSetPredictionHintDataSetCb()
        elm_exit();
 }
 
+/**
+* @function                     IMEInputHintSetCb
+* @description          Callback, called when an associated text input UI control requests the input panel to set input hint.
+* @parameter            Ecore_IMF_Input_Hints InputHint, void *pszUserData
+* @return                       void
+*/
+static void IMEInputHintSetCb(Ecore_IMF_Input_Hints InputHint, void *pszUserData)
+{
+       FPRINTF("[Line : %d][%s] IMEInputHintSetCb Callback called\\n", __LINE__, API_NAMESPACE);
+}
+
+/**
+* @function                     InputMethodEventSetInputHintSetCb
+* @description          Callback for ime_run to Set input hint event callback function.
+* @parameter            NA
+* @return                       NA
+*/
+static void InputMethodEventSetInputHintSetCb()
+{
+       g_bCallbackCalled = true;
+       FPRINTF("[Line : %d][%s] InputMethodEventSetInputHintSetCb Callback called\\n", __LINE__, API_NAMESPACE);
+
+       Evas_Object *hWindow = NULL;
+       hWindow = CreateNormalWin();
+       if(!hWindow)
+       {
+               FPRINTF("[Line : %d][%s] CreateNormalWin() called from InputMethodEventSetInputHintSetCb callback is failed to create window\\n", __LINE__, API_NAMESPACE);
+               g_bSupportAPIFailed = true;
+               return;
+       }
+
+       Evas_Object *hEntry = NULL;
+       hEntry = elm_entry_add(hWindow);
+       if(!hEntry)
+       {
+               FPRINTF("[Line : %d][%s] elm_entry_add function failed to add entry to hWindow\\n", __LINE__, API_NAMESPACE);
+               g_bSupportAPIFailed = true;
+               evas_object_del(hWindow);
+               return;
+       }
+
+       g_nRet = ime_event_set_input_hint_set_cb(IMEInputHintSetCb, NULL);
+       PRINT_RESULT_NORETURN(IME_ERROR_NONE, g_nRet, "ime_event_set_input_hint_set_cb", InputGetError(g_nRet));
+
+       elm_entry_single_line_set(hEntry, EINA_TRUE);
+
+       evas_object_del(hWindow);
+       evas_object_del(hEntry);
+
+       elm_exit();
+}
+
+/**
+* @function                     InputMethodEventUnsetInputHintSetCb
+* @description          Callback for ime_run to Unset input hint event callback function.
+* @parameter            NA
+* @return                       NA
+*/
+static void InputMethodEventUnsetInputHintSetCb()
+{
+       g_bCallbackCalled = true;
+       FPRINTF("[Line : %d][%s] InputMethodEventUnsetInputHintSetCb callback called\\n", __LINE__, API_NAMESPACE);
+
+       g_nRet = ime_event_unset_input_hint_set_cb();
+       PRINT_RESULT_NORETURN(IME_ERROR_NONE, g_nRet, "ime_event_unset_input_hint_set_cb", InputGetError(g_nRet));
+       elm_exit();
+}
+
+/**
+* @function                     InputMethodUpdatePreeditCursorCb
+* @description          Callback for ime_run to call preedit cursor function.
+* @parameter            NA
+* @return                       NA
+*/
+static void InputMethodUpdatePreeditCursorCb()
+{
+       g_bCallbackCalled = true;
+       g_bSupportAPIFailed = false;
+       FPRINTF("[Line : %d][%s] InputMethodUpdatePreeditCursorCb Callback called\\n", __LINE__, API_NAMESPACE);
+
+       int nRet = -1;
+       Eina_List *list = NULL;
+
+       ime_preedit_attribute *attr = NULL;
+       attr = (ime_preedit_attribute *)calloc(1, sizeof(ime_preedit_attribute));
+
+       if(!attr)
+       {
+               FPRINTF("[Line : %d][%s] calloc is failed inside InputMethodUpdatePreeditCursorCb Callback\\n", __LINE__, API_NAMESPACE);
+               g_bSupportAPIFailed = true;
+               return;
+       }
+
+       attr->start = 0;
+       attr->length = 1;
+       attr->type = IME_ATTR_FONTSTYLE;
+       attr->value = IME_ATTR_FONTSTYLE_UNDERLINE;
+       list = eina_list_append(list, attr);
+
+       attr = calloc(1, sizeof(ime_preedit_attribute));
+       attr->start = 1;
+       attr->length = 3;
+       attr->type = IME_ATTR_FONTSTYLE;
+       attr->value = IME_ATTR_FONTSTYLE_REVERSAL;
+       list = eina_list_append(list, attr);
+
+       nRet = ime_update_preedit_string("abcd", list);
+       if (nRet != IME_ERROR_NONE)
+       {
+               FPRINTF("[Line : %d][%s] ime_update_preedit_string API failed\\n", __LINE__, API_NAMESPACE);
+               EINA_LIST_FREE(list, attr);
+               free(attr);
+       }
+
+       g_nRet = ime_update_preedit_cursor(1);
+       PRINT_RESULT_NORETURN(IME_ERROR_NONE, g_nRet, "ime_update_preedit_cursor", InputGetError(g_nRet));
+
+       elm_exit();
+}
+
 /**
  * @function           ITs_capi_ui_inputmethod_startup
  * @description                Called before each test
@@ -574,5 +694,80 @@ int ITc_ime_event_set_prediction_hint_data_set_cb_p(void)
        PRINT_RESULT(IME_ERROR_NONE, g_nRet, "ime_event_set_prediction_hint_data_set_cb", InputGetError(g_nRet));
 
 }
+
+//& purpose Sets and Unsets input_hint_set event callback function
+//& type: auto
+/**
+* @testcase                            ITc_ime_event_set_unset_input_hint_set_cb_p
+* @since_tizen                 6.5
+* @author                              SRID(j.abhishek)
+* @reviewer                            SRID(nibha.sharma)
+* @type                                        auto
+* @description                 Sets and unset input_hint_set event callback function.
+* @scenario                            The callback function is called to set the input hint to deliver to the input panel.
+* @apicovered                  ime_event_set_input_hint_set_cb, ime_event_set_input_hint_unset_cb
+* @passcase                            If callback gets called and api returns IME_ERROR_NONE
+* @failcase                            If fails to called callback and/or api returns other than IME_ERROR_NONE
+* @precondition                        NA
+* @postcondition               The ime_run() function should be called to start to run IME application's main loop.
+*/
+int ITc_ime_event_set_unset_input_hint_set_cb_p(void)
+{
+       START_TEST;
+
+       g_nRet = -1;
+       g_bCallbackCalled = false;
+       g_bSupportAPIFailed = false;
+
+       int nRet = ime_run(&basic_callback, (void *)InputMethodEventSetInputHintSetCb);
+
+       PRINT_RESULT(IME_ERROR_NONE, nRet, "ime_run", InputGetError(nRet));
+       PRINT_RESULT(true, g_bCallbackCalled, "ime_event_set_input_hint_set_cb", "Callback not invoked");
+       PRINT_RESULT(false, g_bSupportAPIFailed, "ime_event_set_input_hint_set_cb", "Support APIs caled inside callback failed");
+       PRINT_RESULT(IME_ERROR_NONE, g_nRet, "ime_event_set_input_hint_set_cb", InputGetError(g_nRet));
+
+
+       nRet = ime_run(&basic_callback, (void *)InputMethodEventUnsetInputHintSetCb);
+
+       PRINT_RESULT(IME_ERROR_NONE, nRet, "ime_run", InputGetError(nRet));
+       PRINT_RESULT(true, g_bCallbackCalled, "ime_event_unset_input_hint_set_cb", "Callback not invoked");
+       PRINT_RESULT(IME_ERROR_NONE, g_nRet, "ime_event_unset_input_hint_set_cb", InputGetError(g_nRet));
+       return 0;
+}
+
+//& purpose Updates the cursor position in the preedit string.
+//& type: auto
+/**
+* @testcase                            ITc_ime_update_preedit_cursor_p
+* @since_tizen                 6.5
+* @author                              SRID(j.abhishek)
+* @reviewer                            SRID(nibha.sharma)
+* @type                                        auto
+* @description                 Updates the cursor position in the preedit string.
+* @scenario                            Create preedit list and update the cursor position followed by the list
+* @apicovered                  ime_update_preedit_cursor
+* @passcase                            If callback gets called and api returns IME_ERROR_NONE
+* @failcase                            If fails to called callback and/or api returns other than IME_ERROR_NONE
+* @precondition                        NA
+* @postcondition               The ime_run() function should be called to start to run IME application's main loop.
+*                              This API is supposed to be followed by the ime_update_preedit_string() function.
+*/
+int ITc_ime_update_preedit_cursor_p(void)
+{
+       START_TEST;
+
+       g_nRet = -1;
+       g_bCallbackCalled = false;
+       g_bSupportAPIFailed = false;
+
+       int nRet = ime_run(&basic_callback, (void *)InputMethodUpdatePreeditCursorCb);
+
+       PRINT_RESULT(IME_ERROR_NONE, nRet, "ime_run", InputGetError(nRet));
+       PRINT_RESULT(true, g_bCallbackCalled, "ime_update_preedit_cursor", "Callback not invoked");
+       PRINT_RESULT(false, g_bSupportAPIFailed, "ime_update_preedit_cursor", "Support APIs caled inside callback failed");
+       PRINT_RESULT(IME_ERROR_NONE, g_nRet, "ime_update_preedit_cursor", InputGetError(g_nRet));
+
+       return 0;
+}
 /** @} */
 /** @} */
index 7cea955b6b21a7df7a1bb59a42e6fb2d1a31e8c0..ac2ee4c3d18fa909a9b83393ac2224b9c70804ab 100755 (executable)
@@ -31,6 +31,8 @@ extern int ITc_ime_update_input_panel_event_p(void);
 extern int ITc_ime_set_candidate_visibility_state_p(void);
 extern int ITc_ime_event_set_process_key_event_with_keycode_cb_p(void);
 extern int ITc_ime_event_set_prediction_hint_data_set_cb_p(void);
+extern int ITc_ime_event_set_unset_input_hint_set_cb_p(void);
+extern int ITc_ime_update_preedit_cursor_p(void);
 
 testcase tc_array[] = {
        {"ITc_ime_set_floating_mode_p", ITc_ime_set_floating_mode_p, ITs_capi_ui_inputmethod_startup, ITs_capi_ui_inputmethod_cleanup},
@@ -42,6 +44,8 @@ testcase tc_array[] = {
        {"ITc_ime_set_candidate_visibility_state_p", ITc_ime_set_candidate_visibility_state_p, ITs_capi_ui_inputmethod_startup, ITs_capi_ui_inputmethod_cleanup},
        {"ITc_ime_event_set_process_key_event_with_keycode_cb_p", ITc_ime_event_set_process_key_event_with_keycode_cb_p, ITs_capi_ui_inputmethod_startup, ITs_capi_ui_inputmethod_cleanup},
        {"ITc_ime_event_set_prediction_hint_data_set_cb_p", ITc_ime_event_set_prediction_hint_data_set_cb_p, ITs_capi_ui_inputmethod_startup, ITs_capi_ui_inputmethod_cleanup},
+       {"ITc_ime_event_set_unset_input_hint_set_cb_p", ITc_ime_event_set_unset_input_hint_set_cb_p, ITs_capi_ui_inputmethod_startup, ITs_capi_ui_inputmethod_cleanup},
+       {"ITc_ime_update_preedit_cursor_p", ITc_ime_update_preedit_cursor_p, ITs_capi_ui_inputmethod_startup, ITs_capi_ui_inputmethod_cleanup},
        {NULL, NULL}
 };
 
index 7cea955b6b21a7df7a1bb59a42e6fb2d1a31e8c0..ac2ee4c3d18fa909a9b83393ac2224b9c70804ab 100755 (executable)
@@ -31,6 +31,8 @@ extern int ITc_ime_update_input_panel_event_p(void);
 extern int ITc_ime_set_candidate_visibility_state_p(void);
 extern int ITc_ime_event_set_process_key_event_with_keycode_cb_p(void);
 extern int ITc_ime_event_set_prediction_hint_data_set_cb_p(void);
+extern int ITc_ime_event_set_unset_input_hint_set_cb_p(void);
+extern int ITc_ime_update_preedit_cursor_p(void);
 
 testcase tc_array[] = {
        {"ITc_ime_set_floating_mode_p", ITc_ime_set_floating_mode_p, ITs_capi_ui_inputmethod_startup, ITs_capi_ui_inputmethod_cleanup},
@@ -42,6 +44,8 @@ testcase tc_array[] = {
        {"ITc_ime_set_candidate_visibility_state_p", ITc_ime_set_candidate_visibility_state_p, ITs_capi_ui_inputmethod_startup, ITs_capi_ui_inputmethod_cleanup},
        {"ITc_ime_event_set_process_key_event_with_keycode_cb_p", ITc_ime_event_set_process_key_event_with_keycode_cb_p, ITs_capi_ui_inputmethod_startup, ITs_capi_ui_inputmethod_cleanup},
        {"ITc_ime_event_set_prediction_hint_data_set_cb_p", ITc_ime_event_set_prediction_hint_data_set_cb_p, ITs_capi_ui_inputmethod_startup, ITs_capi_ui_inputmethod_cleanup},
+       {"ITc_ime_event_set_unset_input_hint_set_cb_p", ITc_ime_event_set_unset_input_hint_set_cb_p, ITs_capi_ui_inputmethod_startup, ITs_capi_ui_inputmethod_cleanup},
+       {"ITc_ime_update_preedit_cursor_p", ITc_ime_update_preedit_cursor_p, ITs_capi_ui_inputmethod_startup, ITs_capi_ui_inputmethod_cleanup},
        {NULL, NULL}
 };
 
index 7cea955b6b21a7df7a1bb59a42e6fb2d1a31e8c0..ac2ee4c3d18fa909a9b83393ac2224b9c70804ab 100755 (executable)
@@ -31,6 +31,8 @@ extern int ITc_ime_update_input_panel_event_p(void);
 extern int ITc_ime_set_candidate_visibility_state_p(void);
 extern int ITc_ime_event_set_process_key_event_with_keycode_cb_p(void);
 extern int ITc_ime_event_set_prediction_hint_data_set_cb_p(void);
+extern int ITc_ime_event_set_unset_input_hint_set_cb_p(void);
+extern int ITc_ime_update_preedit_cursor_p(void);
 
 testcase tc_array[] = {
        {"ITc_ime_set_floating_mode_p", ITc_ime_set_floating_mode_p, ITs_capi_ui_inputmethod_startup, ITs_capi_ui_inputmethod_cleanup},
@@ -42,6 +44,8 @@ testcase tc_array[] = {
        {"ITc_ime_set_candidate_visibility_state_p", ITc_ime_set_candidate_visibility_state_p, ITs_capi_ui_inputmethod_startup, ITs_capi_ui_inputmethod_cleanup},
        {"ITc_ime_event_set_process_key_event_with_keycode_cb_p", ITc_ime_event_set_process_key_event_with_keycode_cb_p, ITs_capi_ui_inputmethod_startup, ITs_capi_ui_inputmethod_cleanup},
        {"ITc_ime_event_set_prediction_hint_data_set_cb_p", ITc_ime_event_set_prediction_hint_data_set_cb_p, ITs_capi_ui_inputmethod_startup, ITs_capi_ui_inputmethod_cleanup},
+       {"ITc_ime_event_set_unset_input_hint_set_cb_p", ITc_ime_event_set_unset_input_hint_set_cb_p, ITs_capi_ui_inputmethod_startup, ITs_capi_ui_inputmethod_cleanup},
+       {"ITc_ime_update_preedit_cursor_p", ITc_ime_update_preedit_cursor_p, ITs_capi_ui_inputmethod_startup, ITs_capi_ui_inputmethod_cleanup},
        {NULL, NULL}
 };
 
index 7cea955b6b21a7df7a1bb59a42e6fb2d1a31e8c0..ac2ee4c3d18fa909a9b83393ac2224b9c70804ab 100755 (executable)
@@ -31,6 +31,8 @@ extern int ITc_ime_update_input_panel_event_p(void);
 extern int ITc_ime_set_candidate_visibility_state_p(void);
 extern int ITc_ime_event_set_process_key_event_with_keycode_cb_p(void);
 extern int ITc_ime_event_set_prediction_hint_data_set_cb_p(void);
+extern int ITc_ime_event_set_unset_input_hint_set_cb_p(void);
+extern int ITc_ime_update_preedit_cursor_p(void);
 
 testcase tc_array[] = {
        {"ITc_ime_set_floating_mode_p", ITc_ime_set_floating_mode_p, ITs_capi_ui_inputmethod_startup, ITs_capi_ui_inputmethod_cleanup},
@@ -42,6 +44,8 @@ testcase tc_array[] = {
        {"ITc_ime_set_candidate_visibility_state_p", ITc_ime_set_candidate_visibility_state_p, ITs_capi_ui_inputmethod_startup, ITs_capi_ui_inputmethod_cleanup},
        {"ITc_ime_event_set_process_key_event_with_keycode_cb_p", ITc_ime_event_set_process_key_event_with_keycode_cb_p, ITs_capi_ui_inputmethod_startup, ITs_capi_ui_inputmethod_cleanup},
        {"ITc_ime_event_set_prediction_hint_data_set_cb_p", ITc_ime_event_set_prediction_hint_data_set_cb_p, ITs_capi_ui_inputmethod_startup, ITs_capi_ui_inputmethod_cleanup},
+       {"ITc_ime_event_set_unset_input_hint_set_cb_p", ITc_ime_event_set_unset_input_hint_set_cb_p, ITs_capi_ui_inputmethod_startup, ITs_capi_ui_inputmethod_cleanup},
+       {"ITc_ime_update_preedit_cursor_p", ITc_ime_update_preedit_cursor_p, ITs_capi_ui_inputmethod_startup, ITs_capi_ui_inputmethod_cleanup},
        {NULL, NULL}
 };