utc_ecore_imf_context_del.c
utc_ecore_imf_context_reset.c
utc_ecore_imf_context_selection_get.c
+utc_ecore_imf_context_show.c
+utc_ecore_imf_context_hide.c
utc_ecore_imf_context_info_get.c
utc_ecore_imf_context_info_by_id_get.c
utc_ecore_imf_context_data_get_set.c
utc_ecore_imf_context_default_id_get.c
utc_ecore_imf_context_default_id_by_canvas_type_get.c
utc_ecore_imf_context_surrounding_get.c
+utc_ecore_imf_context_commit_event_add.c
utc_ecore_imf_context_event_callback_add.c
utc_ecore_imf_context_event_callback_call.c
utc_ecore_imf_context_event_callback_del.c
utc_ecore_imf_context_cursor_position_set.c
utc_ecore_imf_context_retrieve_selection_callback_set.c
utc_ecore_imf_context_retrieve_surrounding_callback_set.c
+utc_ecore_imf_context_delete_surrounding_event_add.c
+utc_ecore_imf_context_preedit_changed_event_add.c
+utc_ecore_imf_context_preedit_end_event_add.c
+utc_ecore_imf_context_preedit_start_event_add.c
utc_ecore_imf_context_preedit_string_with_attributes_get.c
utc_ecore_imf_context_preedit_string_get.c
utc_ecore_imf_context_prediction_allow_get_set.c
utc_ecore_imf_context_client_window_get_set.c
utc_ecore_imf_context_client_canvas_get_set.c
utc_ecore_imf_context_use_preedit_set.c
+utc_ecore_imf_context_control_panel_show.c
+utc_ecore_imf_context_control_panel_hide.c
utc_ecore_imf_context_candidate_panel_geometry_get.c
utc_ecore_imf_context_input_panel_imdata_get_set.c
utc_ecore_imf_context_input_panel_language_locale_get.c
utc_ecore_imf_context_del.c
utc_ecore_imf_context_reset.c
utc_ecore_imf_context_selection_get.c
+utc_ecore_imf_context_show.c
+utc_ecore_imf_context_hide.c
utc_ecore_imf_context_info_get.c
utc_ecore_imf_context_info_by_id_get.c
utc_ecore_imf_context_data_get_set.c
utc_ecore_imf_context_default_id_get.c
utc_ecore_imf_context_default_id_by_canvas_type_get.c
utc_ecore_imf_context_surrounding_get.c
+utc_ecore_imf_context_commit_event_add.c
utc_ecore_imf_context_event_callback_add.c
utc_ecore_imf_context_event_callback_call.c
utc_ecore_imf_context_event_callback_del.c
utc_ecore_imf_context_cursor_position_set.c
utc_ecore_imf_context_retrieve_selection_callback_set.c
utc_ecore_imf_context_retrieve_surrounding_callback_set.c
+utc_ecore_imf_context_delete_surrounding_event_add.c
+utc_ecore_imf_context_preedit_changed_event_add.c
+utc_ecore_imf_context_preedit_end_event_add.c
+utc_ecore_imf_context_preedit_start_event_add.c
utc_ecore_imf_context_preedit_string_with_attributes_get.c
utc_ecore_imf_context_preedit_string_get.c
utc_ecore_imf_context_prediction_allow_get_set.c
utc_ecore_imf_context_client_window_get_set.c
utc_ecore_imf_context_client_canvas_get_set.c
utc_ecore_imf_context_use_preedit_set.c
+utc_ecore_imf_context_control_panel_show.c
+utc_ecore_imf_context_control_panel_hide.c
utc_ecore_imf_context_candidate_panel_geometry_get.c
utc_ecore_imf_context_input_panel_imdata_get_set.c
utc_ecore_imf_context_input_panel_language_locale_get.c
utc_ecore_imf_context_del.c
utc_ecore_imf_context_reset.c
utc_ecore_imf_context_selection_get.c
+utc_ecore_imf_context_show.c
+utc_ecore_imf_context_hide.c
utc_ecore_imf_context_info_get.c
utc_ecore_imf_context_info_by_id_get.c
utc_ecore_imf_context_data_get_set.c
utc_ecore_imf_context_default_id_get.c
utc_ecore_imf_context_default_id_by_canvas_type_get.c
utc_ecore_imf_context_surrounding_get.c
+utc_ecore_imf_context_commit_event_add.c
utc_ecore_imf_context_event_callback_add.c
utc_ecore_imf_context_event_callback_call.c
utc_ecore_imf_context_event_callback_del.c
utc_ecore_imf_context_cursor_position_set.c
utc_ecore_imf_context_retrieve_selection_callback_set.c
utc_ecore_imf_context_retrieve_surrounding_callback_set.c
+utc_ecore_imf_context_delete_surrounding_event_add.c
+utc_ecore_imf_context_preedit_changed_event_add.c
+utc_ecore_imf_context_preedit_end_event_add.c
+utc_ecore_imf_context_preedit_start_event_add.c
utc_ecore_imf_context_preedit_string_with_attributes_get.c
utc_ecore_imf_context_preedit_string_get.c
utc_ecore_imf_context_prediction_allow_get_set.c
utc_ecore_imf_context_client_window_get_set.c
utc_ecore_imf_context_client_canvas_get_set.c
utc_ecore_imf_context_use_preedit_set.c
+utc_ecore_imf_context_control_panel_show.c
+utc_ecore_imf_context_control_panel_hide.c
utc_ecore_imf_context_candidate_panel_geometry_get.c
utc_ecore_imf_context_input_panel_imdata_get_set.c
utc_ecore_imf_context_input_panel_language_locale_get.c
utc_ecore_imf_context_del.c
utc_ecore_imf_context_reset.c
utc_ecore_imf_context_selection_get.c
+utc_ecore_imf_context_show.c
+utc_ecore_imf_context_hide.c
utc_ecore_imf_context_info_get.c
utc_ecore_imf_context_info_by_id_get.c
utc_ecore_imf_context_data_get_set.c
utc_ecore_imf_context_default_id_get.c
utc_ecore_imf_context_default_id_by_canvas_type_get.c
utc_ecore_imf_context_surrounding_get.c
+utc_ecore_imf_context_commit_event_add.c
utc_ecore_imf_context_event_callback_add.c
utc_ecore_imf_context_event_callback_call.c
utc_ecore_imf_context_event_callback_del.c
utc_ecore_imf_context_cursor_position_set.c
utc_ecore_imf_context_retrieve_selection_callback_set.c
utc_ecore_imf_context_retrieve_surrounding_callback_set.c
+utc_ecore_imf_context_delete_surrounding_event_add.c
+utc_ecore_imf_context_preedit_changed_event_add.c
+utc_ecore_imf_context_preedit_end_event_add.c
+utc_ecore_imf_context_preedit_start_event_add.c
utc_ecore_imf_context_preedit_string_with_attributes_get.c
utc_ecore_imf_context_preedit_string_get.c
utc_ecore_imf_context_prediction_allow_get_set.c
utc_ecore_imf_context_client_window_get_set.c
utc_ecore_imf_context_client_canvas_get_set.c
utc_ecore_imf_context_use_preedit_set.c
+utc_ecore_imf_context_control_panel_show.c
+utc_ecore_imf_context_control_panel_hide.c
utc_ecore_imf_context_candidate_panel_geometry_get.c
utc_ecore_imf_context_input_panel_imdata_get_set.c
utc_ecore_imf_context_input_panel_language_locale_get.c
utc_ecore_imf_context_del.c
utc_ecore_imf_context_reset.c
utc_ecore_imf_context_selection_get.c
+utc_ecore_imf_context_show.c
+utc_ecore_imf_context_hide.c
utc_ecore_imf_context_info_get.c
utc_ecore_imf_context_info_by_id_get.c
utc_ecore_imf_context_data_get_set.c
utc_ecore_imf_context_default_id_get.c
utc_ecore_imf_context_default_id_by_canvas_type_get.c
utc_ecore_imf_context_surrounding_get.c
+utc_ecore_imf_context_commit_event_add.c
utc_ecore_imf_context_event_callback_add.c
utc_ecore_imf_context_event_callback_call.c
utc_ecore_imf_context_event_callback_del.c
utc_ecore_imf_context_cursor_position_set.c
utc_ecore_imf_context_retrieve_selection_callback_set.c
utc_ecore_imf_context_retrieve_surrounding_callback_set.c
+utc_ecore_imf_context_delete_surrounding_event_add.c
+utc_ecore_imf_context_preedit_changed_event_add.c
+utc_ecore_imf_context_preedit_end_event_add.c
+utc_ecore_imf_context_preedit_start_event_add.c
utc_ecore_imf_context_preedit_string_with_attributes_get.c
utc_ecore_imf_context_preedit_string_get.c
utc_ecore_imf_context_prediction_allow_get_set.c
utc_ecore_imf_context_client_window_get_set.c
utc_ecore_imf_context_client_canvas_get_set.c
utc_ecore_imf_context_use_preedit_set.c
+utc_ecore_imf_context_control_panel_show.c
+utc_ecore_imf_context_control_panel_hide.c
utc_ecore_imf_context_candidate_panel_geometry_get.c
utc_ecore_imf_context_input_panel_imdata_get_set.c
utc_ecore_imf_context_input_panel_language_locale_get.c
--- /dev/null
+#include <check.h>
+#include <Eina.h>
+#include <Ecore.h>
+#include "../utc_ecore_common.h"
+#include <Ecore_IMF.h>
+
+#include "../../utc_negative_unitest.h"
+
+#define IMF_CONTEXT_ID "test"
+#define WAIT_FOR(duration) \
+ do \
+ { \
+ if (ecore_timer_add(duration, _timer_cb, NULL) == NULL) \
+ { \
+ ck_abort_msg("[TEST_FAIL:: %s[%d] : Test has failed (timer cannot be created for testing)..", __FILE__, __LINE__); \
+ return; \
+ } \
+ ecore_main_loop_begin(); \
+ } while (0);
+
+
+static Eina_Bool startup_status = EINA_FALSE;
+static int callback_counter = 0;
+
+/**
+ * @addtogroup ecore_imf_context
+ * @{
+ * @defgroup ecore_imf_context_commit_event_add ecore_imf_context_commit_event_add()
+ *
+ *
+ * @precondition
+ * @step 1 Call ecore_init() for the Ecore library initialization.
+ * @step 2 Call ecore_imf_init() for the Ecore_Imf library initialization.
+ */
+static void
+setup(void)
+{
+ printf(" ============ Startup ============ \n");
+ UTC_ECORE_INIT();
+ {
+ if (ecore_imf_init() > 0)
+ {
+ startup_status = EINA_TRUE;
+ }
+ }
+}
+
+static void
+teardown(void)
+{
+ ecore_imf_shutdown();
+ ecore_shutdown();
+ printf(" ============ Cleanup ============ \n");
+}
+
+static Eina_Bool _ecore_imf_cb(void *data, int type, void *event)
+{
+ callback_counter++;
+ ecore_main_loop_quit();
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static Eina_Bool _timer_cb(void *data)
+{
+ ecore_main_loop_quit();
+ return EINA_FALSE;
+}
+static const Ecore_IMF_Context_Info isf_imf_info =
+{
+ IMF_CONTEXT_ID,
+ "test Ecore",
+ "*",
+ NULL,
+ 0
+};
+
+static void add(Ecore_IMF_Context *ctx)
+{
+}
+static void del(Ecore_IMF_Context *ctx)
+{
+}
+static void client_window_set(Ecore_IMF_Context *ctx, void *window)
+{
+}
+static Ecore_IMF_Context_Class cl = { .add = add, .del = del, .client_window_set = client_window_set };
+
+static Ecore_IMF_Context *imf_module_create(void)
+{
+ Ecore_IMF_Context* ctx = NULL;
+ ctx = ecore_imf_context_new(&cl);
+ return ctx;
+}
+
+static Ecore_IMF_Context *imf_module_exit(void)
+{
+ return NULL;
+}
+
+/**
+ * @addtogroup ecore_imf_context_commit_event_add
+ * @{
+ * @objective Positive test case checks that tested function really adds ECORE_IMF_EVENT_COMMIT to the event queue.
+ * @n Input Data:
+ * @li the given Ecore_IMF_Context object;
+ * @li empty string.
+ *
+ * @procedure
+ * @step 1 Register imf_module.
+ * @step 2 Add new Ecore_IMF_Context object using default ID ("test").
+ * @step 3 Add ECORE_IMF_EVENT_COMMIT event to the event queue.
+ * @step 4 Add callback for processing of ECORE_IMF_EVENT_COMMIT event.
+ * @step 5 Wait for 0.5 seconds.
+ * @step 6 Check that the callback was called.
+ *
+ * @passcondition
+ * Variable named callback_counter must be positive, and there is no segmentation fault.
+ * @}
+ */
+START_TEST(utc_ecore_imf_context_commit_event_add_p)
+{
+ if (startup_status != EINA_TRUE)
+ {
+ ck_abort_msg("[TEST_FAIL:: %s[%d] : Test has failed (startup was been executed unsuccessfully)..", __FILE__, __LINE__);
+ return;
+ }
+
+ Ecore_IMF_Context* ctx = NULL;
+
+ ecore_imf_module_register(&isf_imf_info, imf_module_create, imf_module_exit);
+ ctx = ecore_imf_context_add(IMF_CONTEXT_ID);
+ if (ctx == NULL)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed (new Input Method Context cannot be created)..", __FILE__, __LINE__);
+ return;
+ }
+ ecore_imf_context_commit_event_add(ctx, "");
+ if (ecore_event_handler_add(ECORE_IMF_EVENT_COMMIT, _ecore_imf_cb, NULL) == NULL)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed (callback on ECORE_IMF_EVENT_COMMIT cannot be added)..", __FILE__, __LINE__);
+ return;
+ }
+ WAIT_FOR(0.5)
+ ecore_imf_context_del(ctx);
+ if (callback_counter == 0)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+ return;
+ }
+ printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
+}
+END_TEST
+
+/**
+ * @addtogroup ecore_imf_context_commit_event_add
+ * @{
+ * @objective Negative test case checks situation if first argument is NULL.
+ * @n Input Data:
+ * @li the given Ecore_IMF_Context object (it will be replaced by NULL in the universal macro);
+ * @li empty string.
+ *
+ * @procedure
+ * @step 1 Register imf_module.
+ * @step 2 Add new Ecore_IMF_Context object using default ID ("test").
+ * @step 3 Use UNITEST_FUNC_NEG for negative testing.
+ *
+ * @passcondition
+ * There is no segmentation fault.
+ * @}
+ */
+START_TEST(utc_ecore_imf_context_commit_event_add_n)
+{
+ if (startup_status != EINA_TRUE)
+ {
+ ck_abort_msg("[TEST_FAIL:: %s[%d] : Test has failed (startup was been executed unsuccessfully)..", __FILE__, __LINE__);
+ return;
+ }
+
+ Ecore_IMF_Context* ctx = NULL;
+
+ ecore_imf_module_register(&isf_imf_info, imf_module_create, imf_module_exit);
+ ctx = ecore_imf_context_add(IMF_CONTEXT_ID);
+ if (ctx == NULL)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed (new Input Method Context cannot be created)..", __FILE__, __LINE__);
+ return;
+ }
+ UNITEST_FUNC_NEG(ecore_imf_context_commit_event_add, ctx, "");
+ ecore_imf_context_del(ctx);
+
+ printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
+}
+END_TEST
+
+/**
+ *@}
+ */
+
+TCase * _utc_ecore_imf_context_commit_event_add()
+{
+ TCase *tcase = tcase_create("utc_ecore_imf_context_commit_event_add");
+ tcase_set_timeout(tcase, 30);
+ tcase_add_checked_fixture(tcase, setup, teardown);
+ tcase_add_test(tcase, utc_ecore_imf_context_commit_event_add_p);
+ tcase_add_test(tcase, utc_ecore_imf_context_commit_event_add_n);
+ return tcase;
+}
--- /dev/null
+#include <check.h>
+#include <Eina.h>
+#include <Ecore.h>
+#include "../utc_ecore_common.h"
+#include <Ecore_IMF.h>
+
+#include "../../utc_negative_unitest.h"
+
+#define VALID_ID "test"
+
+static Eina_Bool startup_status = EINA_FALSE;
+static Eina_Bool callback_called = EINA_FALSE;
+
+/**
+ * @addtogroup ecore_imf_context
+ * @{
+ * @defgroup ecore_imf_context_control_panel_hide ecore_imf_context_control_panel_hide()
+ *
+ *
+ * @precondition
+ * @step 1 Call ecore_init() for the Ecore library initialization.
+ * @step 2 Call ecore_imf_init() for the Ecore_Imf library initialization.
+ */
+static void
+setup(void)
+{
+ printf(" ============ Startup ============ \n");
+ UTC_ECORE_INIT();
+ {
+ if (ecore_imf_init() > 0)
+ {
+ startup_status = EINA_TRUE;
+ }
+ }
+}
+
+static void
+teardown(void)
+{
+ ecore_imf_shutdown();
+ ecore_shutdown();
+ printf(" ============ Cleanup ============ \n");
+}
+static const Ecore_IMF_Context_Info isf_imf_info =
+{
+ VALID_ID,
+ "test Ecore",
+ "*",
+ NULL,
+ 0
+};
+
+static void add(Ecore_IMF_Context *ctx)
+{
+}
+static void del(Ecore_IMF_Context *ctx)
+{
+}
+void control_panel_hide(Ecore_IMF_Context *ctx)
+{
+ callback_called = EINA_TRUE;
+}
+static Ecore_IMF_Context_Class ctx_class = { .add = add, .del = del, .control_panel_hide = control_panel_hide, };
+
+static Ecore_IMF_Context *imf_module_create(void)
+{
+ Ecore_IMF_Context* ctx = NULL;
+ ctx = ecore_imf_context_new(&ctx_class);
+ return ctx;
+}
+
+static Ecore_IMF_Context *imf_module_exit(void)
+{
+ return NULL ;
+}
+
+/**
+ * @addtogroup ecore_imf_context_control_panel_hide
+ * @{
+ * @objective Positive test case checks that the tested function asks the given Ecore_IMF_Context object to hide the control panel without any errors.
+ * @n Input Data: the given Ecore_IMF_Context object.
+ *
+ * @procedure
+ * @step 1 Register imf_module.
+ * @step 2 Create new Ecore_IMF_Context using default ID.
+ * @step 3 Hide control panel.
+ * @step 4 Check variable named callback_called. This variable must be changed in the callback function which was called at hiding of control panel.
+ *
+ * @passcondition
+ * The variable named callback_called must be equal to EINA_TRUE, and there is no segmentation fault.
+ * @}
+ */
+START_TEST(utc_ecore_imf_context_control_panel_hide_p)
+{
+ if (startup_status != EINA_TRUE)
+ {
+ ck_abort_msg("[TEST_FAIL:: %s[%d] : Test has failed (startup was been executed unsuccessfully)..", __FILE__, __LINE__);
+ return;
+ }
+
+ Ecore_IMF_Context* ctx = NULL;
+
+ callback_called = EINA_FALSE;
+ ecore_imf_module_register(&isf_imf_info, imf_module_create, imf_module_exit);
+ ctx = ecore_imf_context_add(VALID_ID);
+ if (ctx == NULL)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed (new Input Method Context cannot be created)..", __FILE__, __LINE__);
+ return;
+ }
+ ecore_imf_context_control_panel_hide(ctx);
+ ecore_imf_context_del(ctx);
+
+ if (callback_called == EINA_FALSE)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+ return;
+ }
+ printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
+}
+END_TEST
+
+/**
+ * @addtogroup ecore_imf_context_control_panel_hide
+ * @{
+ * @objective Negative test case checks situation if argument of tested function is NULL.
+ * @n Input Data: the given Ecore_IMF_Context object (it will be replaced by NULL in the universal macro).
+ *
+ * @procedure
+ * @step 1 Register imf_module.
+ * @step 2 Create new Ecore_IMF_Context using default ID.
+ * @step 3 Use UNITEST_FUNC_NEG for negative testing.
+ *
+ * @passcondition
+ * The variable named callback_called must be equal to EINA_FALSE, and there is no segmentation fault.
+ * @}
+ */
+START_TEST(utc_ecore_imf_context_control_panel_hide_n)
+{
+ if (startup_status != EINA_TRUE)
+ {
+ ck_abort_msg("[TEST_FAIL:: %s[%d] : Test has failed (startup was been executed unsuccessfully)..", __FILE__, __LINE__);
+ return;
+ }
+
+ Ecore_IMF_Context* ctx = NULL;
+
+ callback_called = EINA_FALSE;
+ ecore_imf_module_register(&isf_imf_info, imf_module_create, imf_module_exit);
+ ctx = ecore_imf_context_add(VALID_ID);
+ if (ctx == NULL)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed (new Input Method Context cannot be created)..", __FILE__, __LINE__);
+ return;
+ }
+ UNITEST_FUNC_NEG(ecore_imf_context_control_panel_hide, ctx);
+ ecore_imf_context_del(ctx);
+
+ if (callback_called == EINA_TRUE)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+ return;
+ }
+ printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
+}
+END_TEST
+/**
+ *@}
+ */
+
+TCase * _utc_ecore_imf_context_control_panel_hide()
+{
+ TCase *tcase = tcase_create("utc_ecore_imf_context_control_panel_hide");
+ tcase_set_timeout(tcase, 30);
+ tcase_add_checked_fixture(tcase, setup, teardown);
+ tcase_add_test(tcase, utc_ecore_imf_context_control_panel_hide_p);
+ tcase_add_test(tcase, utc_ecore_imf_context_control_panel_hide_n);
+ return tcase;
+}
--- /dev/null
+#include <check.h>
+#include <Eina.h>
+#include <Ecore.h>
+#include "../utc_ecore_common.h"
+#include <Ecore_IMF.h>
+
+#include "../../utc_negative_unitest.h"
+
+#define VALID_ID "test"
+
+static Eina_Bool startup_status = EINA_FALSE;
+static Eina_Bool callback_called = EINA_FALSE;
+
+/**
+ * @addtogroup ecore_imf_context
+ * @{
+ * @defgroup ecore_imf_context_control_panel_show ecore_imf_context_control_panel_show()
+ *
+ *
+ * @precondition
+ * @step 1 Call ecore_init() for the Ecore library initialization.
+ * @step 2 Call ecore_imf_init() for the Ecore_Imf library initialization.
+ */
+static void
+setup(void)
+{
+ printf(" ============ Startup ============ \n");
+ UTC_ECORE_INIT();
+ {
+ if (ecore_imf_init() > 0)
+ {
+ startup_status = EINA_TRUE;
+ }
+ }
+}
+
+static void
+teardown(void)
+{
+ ecore_imf_shutdown();
+ ecore_shutdown();
+ printf(" ============ Cleanup ============ \n");
+}
+static const Ecore_IMF_Context_Info isf_imf_info =
+{
+ VALID_ID,
+ "test Ecore",
+ "*",
+ NULL,
+ 0
+};
+
+static void add(Ecore_IMF_Context *ctx)
+{
+}
+static void del(Ecore_IMF_Context *ctx)
+{
+}
+void control_panel_show(Ecore_IMF_Context *ctx)
+{
+ callback_called = EINA_TRUE;
+}
+static Ecore_IMF_Context_Class ctx_class = { .add = add, .del = del, .control_panel_show = control_panel_show, };
+
+static Ecore_IMF_Context *imf_module_create(void)
+{
+ Ecore_IMF_Context* ctx = NULL;
+ ctx = ecore_imf_context_new(&ctx_class);
+ return ctx;
+}
+
+static Ecore_IMF_Context *imf_module_exit(void)
+{
+ return NULL ;
+}
+
+/**
+ * @addtogroup ecore_imf_context_control_panel_show
+ * @{
+ * @objective Positive test case checks that the tested function asks the given Ecore_IMF_Context object to show the control panel without any errors.
+ * @n Input Data: the given Ecore_IMF_Context object.
+ *
+ * @procedure
+ * @step 1 Register imf_module.
+ * @step 2 Create new Ecore_IMF_Context using default ID.
+ * @step 3 Show control panel.
+ * @step 4 Check variable named callback_called. This variable must be changed in the callback function which was called at showing of control panel.
+ *
+ * @passcondition
+ * The variable named callback_called must be equal to EINA_TRUE, and there is no segmentation fault.
+ * @}
+ */
+START_TEST(utc_ecore_imf_context_control_panel_show_p)
+{
+ if (startup_status != EINA_TRUE)
+ {
+ ck_abort_msg("[TEST_FAIL:: %s[%d] : Test has failed (startup was been executed unsuccessfully)..", __FILE__, __LINE__);
+ return;
+ }
+
+ Ecore_IMF_Context* ctx = NULL;
+
+ ecore_imf_module_register(&isf_imf_info, imf_module_create, imf_module_exit);
+ ctx = ecore_imf_context_add(VALID_ID);
+ if (ctx == NULL)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed (new Input Method Context cannot be created)..", __FILE__, __LINE__);
+ return;
+ }
+ ecore_imf_context_control_panel_show(ctx);
+ ecore_imf_context_del(ctx);
+
+ if (callback_called == EINA_FALSE)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+ return;
+ }
+ printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
+}
+END_TEST
+
+/**
+ * @addtogroup ecore_imf_context_control_panel_show
+ * @{
+ * @objective Negative test case checks situation if argument of tested function is NULL.
+ * @n Input Data: the given Ecore_IMF_Context object (it will be replaced by NULL in the universal macro).
+ *
+ * @procedure
+ * @step 1 Register imf_module.
+ * @step 2 Create new Ecore_IMF_Context using default ID.
+ * @step 3 Use UNITEST_FUNC_NEG for negative testing.
+ *
+ * @passcondition
+ * There is no segmentation fault.
+ * @}
+ */
+START_TEST(utc_ecore_imf_context_control_panel_show_n)
+{
+ if (startup_status != EINA_TRUE)
+ {
+ ck_abort_msg("[TEST_FAIL:: %s[%d] : Test has failed (startup was been executed unsuccessfully)..", __FILE__, __LINE__);
+ return;
+ }
+
+ Ecore_IMF_Context* ctx = NULL;
+
+ ecore_imf_module_register(&isf_imf_info, imf_module_create, imf_module_exit);
+ ctx = ecore_imf_context_add(VALID_ID);
+ if (ctx == NULL)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed (new Input Method Context cannot be created)..", __FILE__, __LINE__);
+ return;
+ }
+ UNITEST_FUNC_NEG(ecore_imf_context_control_panel_show, ctx);
+ ecore_imf_context_del(ctx);
+
+ printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
+}
+END_TEST
+/**
+ *@}
+ */
+
+TCase * _utc_ecore_imf_context_control_panel_show()
+{
+ TCase *tcase = tcase_create("utc_ecore_imf_context_control_panel_show");
+ tcase_set_timeout(tcase, 30);
+ tcase_add_checked_fixture(tcase, setup, teardown);
+ tcase_add_test(tcase, utc_ecore_imf_context_control_panel_show_p);
+ tcase_add_test(tcase, utc_ecore_imf_context_control_panel_show_n);
+ return tcase;
+}
--- /dev/null
+#include <check.h>
+#include <Eina.h>
+#include <Ecore.h>
+#include "../utc_ecore_common.h"
+#include <Ecore_IMF.h>
+
+#include "../../utc_negative_unitest.h"
+
+#define WAIT_FOR(duration) \
+ do \
+ { \
+ if (ecore_timer_add(duration, _timer_cb, NULL) == NULL) \
+ { \
+ ck_abort_msg("[TEST_FAIL:: %s[%d] : Test has failed (timer cannot be created for testing)..", __FILE__, __LINE__); \
+ return; \
+ } \
+ ecore_main_loop_begin(); \
+ } while (0);
+
+
+static Eina_Bool startup_status = EINA_FALSE;
+static int callback_counter = 0;
+
+/**
+ * @addtogroup ecore_imf_context
+ * @{
+ * @defgroup ecore_imf_context_delete_surrounding_event_add ecore_imf_context_delete_surrounding_event_add()
+ *
+ *
+ * @precondition
+ * @step 1 Call ecore_init() for the Ecore library initialization.
+ * @step 2 Call ecore_imf_init() for the Ecore_Imf library initialization.
+ */
+static void
+setup(void)
+{
+ printf(" ============ Startup ============ \n");
+ UTC_ECORE_INIT();
+ {
+ if (ecore_imf_init() > 0)
+ {
+ startup_status = EINA_TRUE;
+ }
+ }
+}
+
+static void
+teardown(void)
+{
+ ecore_imf_shutdown();
+ ecore_shutdown();
+ printf(" ============ Cleanup ============ \n");
+}
+
+static Eina_Bool _ecore_imf_cb(void *data, int type, void *event)
+{
+ callback_counter++;
+ ecore_main_loop_quit();
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static Eina_Bool _timer_cb(void *data)
+{
+ ecore_main_loop_quit();
+ return EINA_FALSE;
+}
+
+/**
+ * @addtogroup ecore_imf_context_delete_surrounding_event_add
+ * @{
+ * @objective Positive test case checks that the tested function adds ECORE_IMF_EVENT_DELETE_SURROUNDING to the event queue.
+ * @n Input Data:
+ * @li the given Ecore_IMF_Context object;
+ * @li 0.
+ * @li 1.
+ *
+ * @procedure
+ * @step 1 Register imf_module.
+ * @step 2 Create new Ecore_IMF_Context object.
+ * @step 3 Add callback for processing of ECORE_IMF_EVENT_DELETE_SURROUNDING event.
+ * @step 4 Add ECORE_IMF_EVENT_COMMIT event to the event queue.
+ *
+ * @passcondition
+ * Variable named callback_counter must be positive, i.e. callback for processing of ECORE_IMF_EVENT_DELETE_SURROUNDING event must be called at least once. Also, there is no segmentation fault.
+ * @}
+ */
+START_TEST(utc_ecore_imf_context_delete_surrounding_event_add_p)
+{
+ if (startup_status != EINA_TRUE)
+ {
+ ck_abort_msg("[TEST_FAIL:: %s[%d] : Test has failed (startup was been executed unsuccessfully)..", __FILE__, __LINE__);
+ return;
+ }
+
+ Ecore_IMF_Context_Class imf_class;
+ Ecore_IMF_Context* ctx = NULL;
+
+ memset(&imf_class, 0, sizeof(imf_class));
+ ctx = ecore_imf_context_new(&imf_class);
+ if (ctx == NULL)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed (new Input Method Context cannot be created)..", __FILE__, __LINE__);
+ return;
+ }
+ if (ecore_event_handler_add(ECORE_IMF_EVENT_DELETE_SURROUNDING, _ecore_imf_cb, NULL) == NULL)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed (callback on ECORE_IMF_EVENT_DELETE_SURROUNDING cannot be added)..", __FILE__, __LINE__);
+ return;
+ }
+ ecore_imf_context_delete_surrounding_event_add(ctx, 0, 1);
+ WAIT_FOR(0.25)
+ ecore_imf_context_del(ctx);
+
+ if (callback_counter <= 0)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+ return;
+ }
+ printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
+}
+END_TEST
+
+/**
+ * @addtogroup ecore_imf_context_delete_surrounding_event_add
+ * @{
+ * @objective Negative test case checks situation if first argument is NULL.
+ * @n Input Data:
+ * @li the given Ecore_IMF_Context object (it will be replaced by NULL in the universal macro);
+ * @li 0.
+ * @li 1.
+ *
+ * @procedure
+ * @step 1 Register imf_module.
+ * @step 2 Create new Ecore_IMF_Context object.
+ * @step 3 Use CREATE_CHECKED_ARGS_ARRAY() macro for defining arguments of tested function which are subject to substitution for NULL.
+ * @step 4 Use UNITEST_FUNC_NEG_CA for negative testing.
+ *
+ * @passcondition
+ * There is no segmentation fault.
+ * @}
+ */
+START_TEST(utc_ecore_imf_context_delete_surrounding_event_add_n)
+{
+ if (startup_status != EINA_TRUE)
+ {
+ ck_abort_msg("[TEST_FAIL:: %s[%d] : Test has failed (startup was been executed unsuccessfully)..", __FILE__, __LINE__);
+ return;
+ }
+
+ Ecore_IMF_Context_Class imf_class;
+ Ecore_IMF_Context* ctx = NULL;
+
+ memset(&imf_class, 0, sizeof(imf_class));
+ ctx = ecore_imf_context_new(&imf_class);
+ if (ctx == NULL)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed (new Input Method Context cannot be created)..", __FILE__, __LINE__);
+ return;
+ }
+ CREATE_CHECKED_ARGS_ARRAY(1,0,0);
+ UNITEST_FUNC_NEG_CA(ecore_imf_context_delete_surrounding_event_add, ctx, 0, 1);
+ ecore_imf_context_delete_surrounding_event_add(ctx, -10, 1);
+ ecore_imf_context_delete_surrounding_event_add(ctx, 0, -10);
+ ecore_imf_context_del(ctx);
+
+ printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
+}
+END_TEST
+/**
+ *@}
+ */
+
+TCase * _utc_ecore_imf_context_delete_surrounding_event_add()
+{
+ TCase *tcase = tcase_create("utc_ecore_imf_context_delete_surrounding_event_add");
+ tcase_set_timeout(tcase, 30);
+ tcase_add_checked_fixture(tcase, setup, teardown);
+ tcase_add_test(tcase, utc_ecore_imf_context_delete_surrounding_event_add_p);
+ tcase_add_test(tcase, utc_ecore_imf_context_delete_surrounding_event_add_n);
+ return tcase;
+}
--- /dev/null
+#include <check.h>
+#include <Eina.h>
+#include <Ecore.h>
+#include "../utc_ecore_common.h"
+#include <Ecore_IMF.h>
+
+#include "../../utc_negative_unitest.h"
+
+#define VALID_ID "test"
+
+static Eina_Bool startup_status = EINA_FALSE;
+static Eina_Bool called = EINA_FALSE;
+
+/**
+ * @addtogroup ecore_imf_context
+ * @{
+ * @defgroup ecore_imf_context_hide ecore_imf_context_hide()
+ *
+ *
+ * @precondition
+ * @step 1 Call ecore_init() for the Ecore library initialization.
+ * @step 2 Call ecore_imf_init() for the Ecore_Imf library initialization.
+ */
+static void
+setup(void)
+{
+ printf(" ============ Startup ============ \n");
+ UTC_ECORE_INIT();
+ {
+ if (ecore_imf_init() > 0)
+ {
+ startup_status = EINA_TRUE;
+ }
+ }
+}
+
+static void
+teardown(void)
+{
+ ecore_imf_shutdown();
+ ecore_shutdown();
+ printf(" ============ Cleanup ============ \n");
+}
+static const Ecore_IMF_Context_Info isf_imf_info =
+{
+ VALID_ID,
+ "test Ecore",
+ "*",
+ NULL,
+ 0
+};
+
+static void add(Ecore_IMF_Context *ctx)
+{
+}
+static void del(Ecore_IMF_Context *ctx)
+{
+}
+static void hide(Ecore_IMF_Context *ctx)
+{
+ called = EINA_TRUE;
+}
+static Ecore_IMF_Context_Class ctx_class = { .add = add, .del = del, .hide = hide };
+
+static Ecore_IMF_Context *imf_module_create(void)
+{
+ Ecore_IMF_Context* ctx = NULL;
+ ctx = ecore_imf_context_new(&ctx_class);
+ return ctx;
+}
+
+static Ecore_IMF_Context *imf_module_exit(void)
+{
+ return NULL;
+}
+
+/**
+ * @addtogroup ecore_imf_context_hide
+ * @{
+ * @objective Positive test case checks that the tested function doesn't generate errors at asking the Input_Method_Context object to hide itself.
+ * @n Input Data: the given Ecore_IMF_Context object.
+ *
+ * @procedure
+ * @step 1 Register imf_module.
+ * @step 2 Create new Ecore_IMF_Context using default ID.
+ * @step 3 Call the tested function.
+ * @step 4 Check if the parameter was changed in the callback function.
+ *
+ * @passcondition
+ * Variable named "called" must be changed in the callback function. Also, there is no segmentation fault.
+ * @}
+ */
+START_TEST(utc_ecore_imf_context_hide_p)
+{
+ if (startup_status != EINA_TRUE)
+ {
+ ck_abort_msg("[TEST_FAIL:: %s[%d] : Test has failed (startup was been executed unsuccessfully)..", __FILE__, __LINE__);
+ return;
+ }
+
+ Ecore_IMF_Context* ctx = NULL;
+
+ ecore_imf_module_register(&isf_imf_info, imf_module_create, imf_module_exit);
+ ctx = ecore_imf_context_add(VALID_ID);
+ if (ctx == NULL)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed (new Input Method Context cannot be created)..", __FILE__, __LINE__);
+ return;
+ }
+ ecore_imf_context_hide(ctx);
+ ecore_imf_context_del(ctx);
+
+ if (called == EINA_FALSE)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+ return;
+ }
+ printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
+}
+END_TEST
+
+/**
+ * @addtogroup ecore_imf_context_hide
+ * @{
+ * @objective Negative test case checks situation if argument is NULL.
+ * @n Input Data: the given Ecore_IMF_Context object (it will be replaced by NULL).
+ *
+ * @procedure
+ * @step 1 Register imf_module.
+ * @step 2 Use UNITEST_FUNC_NEG for negative testing.
+ *
+ * @passcondition
+ * There is no segmentation fault.
+ * @}
+ */
+START_TEST(utc_ecore_imf_context_hide_n)
+{
+ if (startup_status != EINA_TRUE)
+ {
+ ck_abort_msg("[TEST_FAIL:: %s[%d] : Test has failed (startup was been executed unsuccessfully)..", __FILE__, __LINE__);
+ return;
+ }
+
+ Ecore_IMF_Context* ctx = NULL;
+
+ ecore_imf_module_register(&isf_imf_info, imf_module_create, imf_module_exit);
+ ctx = ecore_imf_context_add(VALID_ID);
+ if (ctx == NULL)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed (new Input Method Context cannot be created)..", __FILE__, __LINE__);
+ return;
+ }
+ UNITEST_FUNC_NEG(ecore_imf_context_hide, ctx);
+ ecore_imf_context_del(ctx);
+
+ printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
+}
+END_TEST
+/**
+ *@}
+ */
+
+TCase * _utc_ecore_imf_context_hide()
+{
+ TCase *tcase = tcase_create("utc_ecore_imf_context_hide");
+ tcase_set_timeout(tcase, 30);
+ tcase_add_checked_fixture(tcase, setup, teardown);
+ tcase_add_test(tcase, utc_ecore_imf_context_hide_p);
+ tcase_add_test(tcase, utc_ecore_imf_context_hide_n);
+ return tcase;
+}
--- /dev/null
+#include <check.h>
+#include <Eina.h>
+#include <Ecore.h>
+#include "../utc_ecore_common.h"
+#include <Ecore_IMF.h>
+
+#include "../../utc_negative_unitest.h"
+
+#define DEFAULT_ID "test"
+#define WAIT_FOR(duration) \
+ do \
+ { \
+ if (ecore_timer_add(duration, _timer_cb, NULL) == NULL) \
+ { \
+ ck_abort_msg("[TEST_FAIL:: %s[%d] : Test has failed (timer cannot be created for testing)..", __FILE__, __LINE__); \
+ return; \
+ } \
+ ecore_main_loop_begin(); \
+ } while (0);
+
+
+static Eina_Bool startup_status = EINA_FALSE;
+static int callback_counter = 0;
+
+/**
+ * @addtogroup ecore_imf_context
+ * @{
+ * @defgroup ecore_imf_context_preedit_changed_event_add ecore_imf_context_preedit_changed_event_add()
+ *
+ *
+ * @precondition
+ * @step 1 Call ecore_init() for the Ecore library initialization.
+ * @step 2 Call ecore_imf_init() for the Ecore_Imf library initialization.
+ */
+static void
+setup(void)
+{
+ printf(" ============ Startup ============ \n");
+ UTC_ECORE_INIT();
+ {
+ if (ecore_imf_init() > 0)
+ {
+ startup_status = EINA_TRUE;
+ }
+ }
+}
+
+static void
+teardown(void)
+{
+ ecore_imf_shutdown();
+ ecore_shutdown();
+ printf(" ============ Cleanup ============ \n");
+}
+
+static Eina_Bool _ecore_imf_cb(void *data, int type, void *event)
+{
+ callback_counter++;
+ ecore_main_loop_quit();
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static Eina_Bool _timer_cb(void *data)
+{
+ ecore_main_loop_quit();
+ return EINA_FALSE;
+}
+static const Ecore_IMF_Context_Info isf_imf_info =
+{
+ DEFAULT_ID,
+ "test Ecore",
+ "*",
+ NULL,
+ 0
+};
+
+static void add(Ecore_IMF_Context *ctx)
+{
+}
+
+static void del(Ecore_IMF_Context *ctx)
+{
+}
+static Ecore_IMF_Context_Class cl = { .add = add, .del = del, };
+
+static Ecore_IMF_Context *imf_module_create(void)
+{
+ Ecore_IMF_Context* ctx = NULL;
+ ctx = ecore_imf_context_new(&cl);
+ return ctx;
+}
+
+static Ecore_IMF_Context *imf_module_exit(void)
+{
+ return NULL;
+}
+
+/**
+ * @addtogroup ecore_imf_context_preedit_changed_event_add
+ * @{
+ * @objective Positive test case checks that tested function really adds ECORE_IMF_EVENT_PREEDIT_CHANGED to the event queue.
+ * @n Input Data: the given Ecore_IMF_Context object.
+ *
+ * @procedure
+ * @step 1 Register imf_module.
+ * @step 2 Add new Ecore_IMF_Context object using default ID ("test").
+ * @step 3 Add ECORE_IMF_EVENT_PREEDIT_CHANGED event to the event queue.
+ * @step 4 Add callback for processing of ECORE_IMF_EVENT_PREEDIT_CHANGED event.
+ * @step 5 Wait for 0.5 seconds.
+ * @step 6 Check that the callback was called.
+ *
+ * @passcondition
+ * Variable named callback_counter must be positive, and there is no segmentation fault.
+ * @}
+ */
+START_TEST(utc_ecore_imf_context_preedit_changed_event_add_p)
+{
+ if (startup_status != EINA_TRUE)
+ {
+ ck_abort_msg("[TEST_FAIL:: %s[%d] : Test has failed (startup was been executed unsuccessfully)..", __FILE__, __LINE__);
+ return;
+ }
+
+ Ecore_IMF_Context* ctx = NULL;
+
+ ecore_imf_module_register(&isf_imf_info, imf_module_create, imf_module_exit);
+ ctx = ecore_imf_context_add(DEFAULT_ID);
+ if (ctx == NULL)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed (new Input Method Context cannot be created)..", __FILE__, __LINE__);
+ return;
+ }
+ ecore_imf_context_preedit_changed_event_add(ctx);
+ if (ecore_event_handler_add(ECORE_IMF_EVENT_PREEDIT_CHANGED, _ecore_imf_cb, NULL) == NULL)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed (callback on ECORE_IMF_EVENT_PREEDIT_CHANGED cannot be added)..", __FILE__, __LINE__);
+ return;
+ }
+ WAIT_FOR(0.5)
+ ecore_imf_context_del(ctx);
+ if (callback_counter == 0)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+ return;
+ }
+ printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
+}
+END_TEST
+
+/**
+ * @addtogroup ecore_imf_context_preedit_changed_event_add
+ * @{
+ * @objective Negative test case checks situation if first argument is NULL.
+ * @n Input Data: the given Ecore_IMF_Context object (it will be replaced by NULL in the universal macro).
+ *
+ * @procedure
+ * @step 1 Register imf_module.
+ * @step 2 Add new Ecore_IMF_Context object using default ID ("test").
+ * @step 3 Use UNITEST_FUNC_NEG for negative testing.
+ *
+ * @passcondition
+ * There is no segmentation fault.
+ * @}
+ */
+START_TEST(utc_ecore_imf_context_preedit_changed_event_add_n)
+{
+ if (startup_status != EINA_TRUE)
+ {
+ ck_abort_msg("[TEST_FAIL:: %s[%d] : Test has failed (startup was been executed unsuccessfully)..", __FILE__, __LINE__);
+ return;
+ }
+
+ Ecore_IMF_Context* ctx = NULL;
+
+ ecore_imf_module_register(&isf_imf_info, imf_module_create, imf_module_exit);
+ ctx = ecore_imf_context_add(DEFAULT_ID);
+ if (ctx == NULL)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed (new Input Method Context cannot be created)..", __FILE__, __LINE__);
+ return;
+ }
+ UNITEST_FUNC_NEG(ecore_imf_context_preedit_changed_event_add, ctx);
+ ecore_imf_context_del(ctx);
+
+ printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
+}
+END_TEST
+/**
+ *@}
+ */
+
+TCase * _utc_ecore_imf_context_preedit_changed_event_add()
+{
+ TCase *tcase = tcase_create("utc_ecore_imf_context_preedit_changed_event_add");
+ tcase_set_timeout(tcase, 30);
+ tcase_add_checked_fixture(tcase, setup, teardown);
+ tcase_add_test(tcase, utc_ecore_imf_context_preedit_changed_event_add_p);
+ tcase_add_test(tcase, utc_ecore_imf_context_preedit_changed_event_add_n);
+ return tcase;
+}
--- /dev/null
+#include <check.h>
+#include <Eina.h>
+#include <Ecore.h>
+#include "../utc_ecore_common.h"
+#include <Ecore_IMF.h>
+
+#include "../../utc_negative_unitest.h"
+
+#define DEFAULT_ID "test"
+#define WAIT_FOR(duration) \
+ do \
+ { \
+ if (ecore_timer_add(duration, _timer_cb, NULL) == NULL) \
+ { \
+ ck_abort_msg("[TEST_FAIL:: %s[%d] : Test has failed (timer cannot be created for testing)..", __FILE__, __LINE__); \
+ return; \
+ } \
+ ecore_main_loop_begin(); \
+ } while (0);
+
+
+static Eina_Bool startup_status = EINA_FALSE;
+static int callback_counter = 0;
+
+/**
+ * @addtogroup ecore_imf_context
+ * @{
+ * @defgroup ecore_imf_context_preedit_end_event_add ecore_imf_context_preedit_end_event_add()
+ *
+ *
+ * @precondition
+ * @step 1 Call ecore_init() for the Ecore library initialization.
+ * @step 2 Call ecore_imf_init() for the Ecore_Imf library initialization.
+ */
+static void
+setup(void)
+{
+ printf(" ============ Startup ============ \n");
+ UTC_ECORE_INIT();
+ {
+ if (ecore_imf_init() > 0)
+ {
+ startup_status = EINA_TRUE;
+ }
+ }
+}
+
+static void
+teardown(void)
+{
+ ecore_imf_shutdown();
+ ecore_shutdown();
+ printf(" ============ Cleanup ============ \n");
+}
+
+static Eina_Bool _ecore_imf_cb(void *data, int type, void *event)
+{
+ callback_counter++;
+ ecore_main_loop_quit();
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static Eina_Bool _timer_cb(void *data)
+{
+ ecore_main_loop_quit();
+ return EINA_FALSE;
+}
+static const Ecore_IMF_Context_Info isf_imf_info =
+{
+ DEFAULT_ID,
+ "test Ecore",
+ "*",
+ NULL,
+ 0
+};
+
+static void add(Ecore_IMF_Context *ctx)
+{
+}
+
+static void del(Ecore_IMF_Context *ctx)
+{
+}
+static Ecore_IMF_Context_Class cl = { .add = add, .del = del, };
+
+static Ecore_IMF_Context *imf_module_create(void)
+{
+ Ecore_IMF_Context* ctx = NULL;
+ ctx = ecore_imf_context_new(&cl);
+ return ctx;
+}
+
+static Ecore_IMF_Context *imf_module_exit(void)
+{
+ return NULL;
+}
+
+/**
+ * @addtogroup ecore_imf_context_preedit_end_event_add
+ * @{
+ * @objective Positive test case checks that tested function really adds ECORE_IMF_EVENT_PREEDIT_END to the event queue.
+ * @n Input Data: the given Ecore_IMF_Context object.
+ *
+ * @procedure
+ * @step 1 Register imf_module.
+ * @step 2 Add new Ecore_IMF_Context object using default ID ("test").
+ * @step 3 Add ECORE_IMF_EVENT_PREEDIT_END event to the event queue.
+ * @step 4 Add callback for processing of ECORE_IMF_EVENT_PREEDIT_END event.
+ * @step 5 Wait for 0.5 seconds.
+ * @step 6 Check that the callback was called.
+ *
+ * @passcondition
+ * Variable named callback_counter must be positive, and there is no segmentation fault.
+ * @}
+ */
+START_TEST(utc_ecore_imf_context_preedit_end_event_add_p)
+{
+ if (startup_status != EINA_TRUE)
+ {
+ ck_abort_msg("[TEST_FAIL:: %s[%d] : Test has failed (startup was been executed unsuccessfully)..", __FILE__, __LINE__);
+ return;
+ }
+
+ Ecore_IMF_Context* ctx = NULL;
+
+ ecore_imf_module_register(&isf_imf_info, imf_module_create, imf_module_exit);
+ ctx = ecore_imf_context_add(DEFAULT_ID);
+ if (ctx == NULL)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed (new Input Method Context cannot be created)..", __FILE__, __LINE__);
+ return;
+ }
+ ecore_imf_context_preedit_end_event_add(ctx);
+ if (ecore_event_handler_add(ECORE_IMF_EVENT_PREEDIT_END, _ecore_imf_cb, NULL) == NULL)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed (callback on ECORE_IMF_EVENT_PREEDIT_END cannot be added)..", __FILE__, __LINE__);
+ return;
+ }
+ WAIT_FOR(0.5)
+ ecore_imf_context_del(ctx);
+ if (callback_counter == 0)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+ return;
+ }
+ printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
+}
+END_TEST
+
+/**
+ * @addtogroup ecore_imf_context_preedit_end_event_add
+ * @{
+ * @objective Negative test case checks situation if argument is NULL.
+ * @n Input Data: the given Ecore_IMF_Context object (it will be replaced by NULL in the universal macro).
+ *
+ * @procedure
+ * @step 1 Register imf_module.
+ * @step 2 Add new Ecore_IMF_Context object using default ID ("test").
+ * @step 3 Use UNITEST_FUNC_NEG for negative testing.
+ *
+ * @passcondition
+ * There is no segmentation fault.
+ * @}
+ */
+START_TEST(utc_ecore_imf_context_preedit_end_event_add_n)
+{
+ if (startup_status != EINA_TRUE)
+ {
+ ck_abort_msg("[TEST_FAIL:: %s[%d] : Test has failed (startup was been executed unsuccessfully)..", __FILE__, __LINE__);
+ return;
+ }
+
+ Ecore_IMF_Context* ctx = NULL;
+
+ ecore_imf_module_register(&isf_imf_info, imf_module_create, imf_module_exit);
+ ctx = ecore_imf_context_add(DEFAULT_ID);
+ if (ctx == NULL)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed (new Input Method Context cannot be created)..", __FILE__, __LINE__);
+ return;
+ }
+ UNITEST_FUNC_NEG(ecore_imf_context_preedit_end_event_add, ctx);
+ ecore_imf_context_del(ctx);
+
+ printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
+}
+END_TEST
+/**
+ *@}
+ */
+
+TCase * _utc_ecore_imf_context_preedit_end_event_add()
+{
+ TCase *tcase = tcase_create("utc_ecore_imf_context_preedit_end_event_add");
+ tcase_set_timeout(tcase, 30);
+ tcase_add_checked_fixture(tcase, setup, teardown);
+ tcase_add_test(tcase, utc_ecore_imf_context_preedit_end_event_add_p);
+ tcase_add_test(tcase, utc_ecore_imf_context_preedit_end_event_add_n);
+ return tcase;
+}
--- /dev/null
+#include <check.h>
+#include <Eina.h>
+#include <Ecore.h>
+#include "../utc_ecore_common.h"
+#include <Ecore_IMF.h>
+
+#include "../../utc_negative_unitest.h"
+
+#define DEFAULT_ID "test"
+#define WAIT_FOR(duration) \
+ do \
+ { \
+ if (ecore_timer_add(duration, _timer_cb, NULL) == NULL) \
+ { \
+ ck_abort_msg("[TEST_FAIL:: %s[%d] : Test has failed (timer cannot be created for testing)..", __FILE__, __LINE__); \
+ return; \
+ } \
+ ecore_main_loop_begin(); \
+ } while (0);
+
+
+static Eina_Bool startup_status = EINA_FALSE;
+static int callback_counter = 0;
+
+/**
+ * @addtogroup ecore_imf_context
+ * @{
+ * @defgroup ecore_imf_context_preedit_start_event_add ecore_imf_context_preedit_start_event_add()
+ *
+ *
+ * @precondition
+ * @step 1 Call ecore_init() for the Ecore library initialization.
+ * @step 2 Call ecore_imf_init() for the Ecore_Imf library initialization.
+ */
+static void
+setup(void)
+{
+ printf(" ============ Startup ============ \n");
+ UTC_ECORE_INIT();
+ {
+ if (ecore_imf_init() > 0)
+ {
+ startup_status = EINA_TRUE;
+ }
+ }
+}
+
+static void
+teardown(void)
+{
+ ecore_imf_shutdown();
+ ecore_shutdown();
+ printf(" ============ Cleanup ============ \n");
+}
+
+static Eina_Bool _ecore_imf_cb(void *data, int type, void *event)
+{
+ callback_counter++;
+ ecore_main_loop_quit();
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static Eina_Bool _timer_cb(void *data)
+{
+ ecore_main_loop_quit();
+ return EINA_FALSE;
+}
+static const Ecore_IMF_Context_Info isf_imf_info =
+{
+ DEFAULT_ID,
+ "test Ecore",
+ "*",
+ NULL,
+ 0
+};
+
+static void add(Ecore_IMF_Context *ctx)
+{
+}
+
+static void del(Ecore_IMF_Context *ctx)
+{
+}
+static Ecore_IMF_Context_Class cl = { .add = add, .del = del, };
+
+static Ecore_IMF_Context *imf_module_create(void)
+{
+ Ecore_IMF_Context* ctx = NULL;
+ ctx = ecore_imf_context_new(&cl);
+ return ctx;
+}
+
+static Ecore_IMF_Context *imf_module_exit(void)
+{
+ return NULL;
+}
+
+/**
+ * @addtogroup ecore_imf_context_preedit_start_event_add
+ * @{
+ * @objective Positive test case checks that tested function really adds ECORE_IMF_EVENT_PREEDIT_START to the event queue.
+ * @n Input Data: the given Ecore_IMF_Context object.
+ *
+ * @procedure
+ * @step 1 Register imf_module.
+ * @step 2 Add new Ecore_IMF_Context object using default ID ("test").
+ * @step 3 Add ECORE_IMF_EVENT_PREEDIT_START event to the event queue.
+ * @step 4 Add callback for processing of ECORE_IMF_EVENT_PREEDIT_START event.
+ * @step 5 Wait for 0.5 seconds.
+ * @step 6 Check that the callback was called.
+ *
+ * @passcondition
+ * Variable named callback_counter must be positive, and there is no segmentation fault.
+ * @}
+ */
+START_TEST(utc_ecore_imf_context_preedit_start_event_add_p)
+{
+ if (startup_status != EINA_TRUE)
+ {
+ ck_abort_msg("[TEST_FAIL:: %s[%d] : Test has failed (startup was been executed unsuccessfully)..", __FILE__, __LINE__);
+ return;
+ }
+
+ Ecore_IMF_Context* ctx = NULL;
+
+ ecore_imf_module_register(&isf_imf_info, imf_module_create, imf_module_exit);
+ ctx = ecore_imf_context_add(DEFAULT_ID);
+ if (ctx == NULL)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed (new Input Method Context cannot be created)..", __FILE__, __LINE__);
+ return;
+ }
+ ecore_imf_context_preedit_start_event_add(ctx);
+ if (ecore_event_handler_add(ECORE_IMF_EVENT_PREEDIT_START, _ecore_imf_cb, NULL) == NULL)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed (callback on ECORE_IMF_EVENT_PREEDIT_START cannot be added)..", __FILE__, __LINE__);
+ return;
+ }
+ WAIT_FOR(0.5)
+ ecore_imf_context_del(ctx);
+ if (callback_counter == 0)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+ return;
+ }
+ printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
+}
+END_TEST
+
+/**
+ * @addtogroup ecore_imf_context_preedit_start_event_add
+ * @{
+ * @objective Negative test case checks situation if argument is NULL.
+ * @n Input Data: the given Ecore_IMF_Context object (it will be replaced by NULL in the universal macro).
+ *
+ * @procedure
+ * @step 1 Register imf_module.
+ * @step 2 Add new Ecore_IMF_Context object using default ID ("test").
+ * @step 3 Use UNITEST_FUNC_NEG for negative testing.
+ *
+ * @passcondition
+ * There is no segmentation fault.
+ * @}
+ */
+START_TEST(utc_ecore_imf_context_preedit_start_event_add_n)
+{
+ if (startup_status != EINA_TRUE)
+ {
+ ck_abort_msg("[TEST_FAIL:: %s[%d] : Test has failed (startup was been executed unsuccessfully)..", __FILE__, __LINE__);
+ return;
+ }
+
+ Ecore_IMF_Context* ctx = NULL;
+
+ ecore_imf_module_register(&isf_imf_info, imf_module_create, imf_module_exit);
+ ctx = ecore_imf_context_add(DEFAULT_ID);
+ if (ctx == NULL)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed (new Input Method Context cannot be created)..", __FILE__, __LINE__);
+ return;
+ }
+ UNITEST_FUNC_NEG(ecore_imf_context_preedit_start_event_add, ctx);
+ ecore_imf_context_del(ctx);
+
+ printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
+}
+END_TEST
+/**
+ *@}
+ */
+
+TCase * _utc_ecore_imf_context_preedit_start_event_add()
+{
+ TCase *tcase = tcase_create("utc_ecore_imf_context_preedit_start_event_add");
+ tcase_set_timeout(tcase, 30);
+ tcase_add_checked_fixture(tcase, setup, teardown);
+ tcase_add_test(tcase, utc_ecore_imf_context_preedit_start_event_add_p);
+ tcase_add_test(tcase, utc_ecore_imf_context_preedit_start_event_add_n);
+ return tcase;
+}
--- /dev/null
+#include <check.h>
+#include <Eina.h>
+#include <Ecore.h>
+#include "../utc_ecore_common.h"
+#include <Ecore_IMF.h>
+
+#include "../../utc_negative_unitest.h"
+
+#define VALID_ID "test"
+
+static Eina_Bool startup_status = EINA_FALSE;
+static Eina_Bool called = EINA_FALSE;
+
+/**
+ * @addtogroup ecore_imf_context
+ * @{
+ * @defgroup ecore_imf_context_show ecore_imf_context_show()
+ *
+ *
+ * @precondition
+ * @step 1 Call ecore_init() for the Ecore library initialization.
+ * @step 2 Call ecore_imf_init() for the Ecore_Imf library initialization.
+ */
+static void
+setup(void)
+{
+ printf(" ============ Startup ============ \n");
+ UTC_ECORE_INIT();
+ {
+ if (ecore_imf_init() > 0)
+ {
+ startup_status = EINA_TRUE;
+ }
+ }
+}
+
+static void
+teardown(void)
+{
+ ecore_imf_shutdown();
+ ecore_shutdown();
+ printf(" ============ Cleanup ============ \n");
+}
+static const Ecore_IMF_Context_Info isf_imf_info =
+{
+ VALID_ID,
+ "test Ecore",
+ "*",
+ NULL,
+ 0
+};
+
+static void add(Ecore_IMF_Context *ctx)
+{
+}
+static void del(Ecore_IMF_Context *ctx)
+{
+}
+static void show(Ecore_IMF_Context *ctx)
+{
+ called = EINA_TRUE;
+}
+static Ecore_IMF_Context_Class ctx_class = { .add = add, .del = del, .show = show };
+
+static Ecore_IMF_Context *imf_module_create(void)
+{
+ Ecore_IMF_Context* ctx = NULL;
+ ctx = ecore_imf_context_new(&ctx_class);
+ return ctx;
+}
+
+static Ecore_IMF_Context *imf_module_exit(void)
+{
+ return NULL;
+}
+
+/**
+ * @addtogroup ecore_imf_context_show
+ * @{
+ * @objective Positive test case checks that the tested function doesn't generate errors at asking the Input_Method_Context object to show itself.
+ * @n Input Data: the given Ecore_IMF_Context object.
+ *
+ * @procedure
+ * @step 1 Register imf_module.
+ * @step 2 Create new Ecore_IMF_Context using default ID.
+ * @step 3 Call the tested function.
+ * @step 4 Check if the parameter was changed in the callback function.
+ *
+ * @passcondition
+ * Variable named "called" must be changed in the callback function. Also, there is no segmentation fault.
+ * @}
+ */
+START_TEST(utc_ecore_imf_context_show_p)
+{
+ if (startup_status != EINA_TRUE)
+ {
+ ck_abort_msg("[TEST_FAIL:: %s[%d] : Test has failed (startup was been executed unsuccessfully)..", __FILE__, __LINE__);
+ return;
+ }
+
+ Ecore_IMF_Context* ctx = NULL;
+
+ ecore_imf_module_register(&isf_imf_info, imf_module_create, imf_module_exit);
+ ctx = ecore_imf_context_add(VALID_ID);
+ if (ctx == NULL)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed (new Input Method Context cannot be created)..", __FILE__, __LINE__);
+ return;
+ }
+ ecore_imf_context_show(ctx);
+ ecore_imf_context_del(ctx);
+
+ if (called == EINA_FALSE)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+ return;
+ }
+ printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
+}
+END_TEST
+
+/**
+ * @addtogroup ecore_imf_context_show
+ * @{
+ * @objective Negative test case checks situation if argument is NULL.
+ * @n Input Data: the given Ecore_IMF_Context object (it will be replaced by NULL).
+ *
+ * @procedure
+ * @step 1 Register imf_module.
+ * @step 2 Use UNITEST_FUNC_NEG for negative testing.
+ *
+ * @passcondition
+ * There is no segmentation fault.
+ * @}
+ */
+START_TEST(utc_ecore_imf_context_show_n)
+{
+ if (startup_status != EINA_TRUE)
+ {
+ ck_abort_msg("[TEST_FAIL:: %s[%d] : Test has failed (startup was been executed unsuccessfully)..", __FILE__, __LINE__);
+ return;
+ }
+
+ Ecore_IMF_Context* ctx = NULL;
+
+ ecore_imf_module_register(&isf_imf_info, imf_module_create, imf_module_exit);
+ ctx = ecore_imf_context_add(VALID_ID);
+ if (ctx == NULL)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed (new Input Method Context cannot be created)..", __FILE__, __LINE__);
+ return;
+ }
+ UNITEST_FUNC_NEG(ecore_imf_context_show, ctx);
+ ecore_imf_context_del(ctx);
+
+ printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
+}
+END_TEST
+/**
+ *@}
+ */
+
+TCase * _utc_ecore_imf_context_show()
+{
+ TCase *tcase = tcase_create("utc_ecore_imf_context_show");
+ tcase_set_timeout(tcase, 30);
+ tcase_add_checked_fixture(tcase, setup, teardown);
+ tcase_add_test(tcase, utc_ecore_imf_context_show_p);
+ tcase_add_test(tcase, utc_ecore_imf_context_show_n);
+ return tcase;
+}