namespace {
+static Ecore_Timer *timer_exit = nullptr;
static bool callback_called = false;
static Ecore_IMF_Input_Panel_State input_panel_state = ECORE_IMF_INPUT_PANEL_STATE_HIDE;
class EcoreIMFContextTest : public testing::Test {
public:
- Ecore_Timer *timer_exit = nullptr;
-
virtual void SetUp() {
setenv("ECORE_IMF_MODULE", "wayland", 1);
setenv("WAYLAND_DISPLAY", "wayland-0", 1);
const char *ctx_id = nullptr;
Evas *evas = nullptr;
Ecore_Evas *ee = nullptr;
- Ecore_Timer *timer_exit = nullptr;
virtual void SetUp() {
setenv("ECORE_IMF_MODULE", "wayland", 1);
static Eina_Bool _timeout_timer_cb(void *data)
{
printf("timeout\n");
+ timer_exit = NULL;
STOP_LOOP();
return ECORE_CALLBACK_DONE;
}
-static void _input_panel_state_cb (void *data, Ecore_IMF_Context *ctx, int value)
+static void _input_panel_state_cb(void *data, Ecore_IMF_Context *ctx, int value)
{
int x, y, w, h;
callback_called = true;
+ if (timer_exit) {
+ ecore_timer_del(timer_exit);
+ timer_exit = NULL;
+ }
+
STOP_LOOP();
}
static void WAIT_FOR_CALLBACK()
{
+ if (timer_exit) {
+ ecore_timer_del(timer_exit);
+ }
+
+ timer_exit = ecore_timer_add(WAIT_RESULT_DELAY, _timeout_timer_cb, NULL);
+
ecore_main_loop_begin();
}
ecore_imf_context_client_canvas_set(ctx, evas);
ecore_imf_context_focus_in(ctx);
- timer_exit = ecore_timer_add(WAIT_RESULT_DELAY, _timeout_timer_cb, NULL);
-
ecore_imf_context_input_panel_event_callback_add(ctx, ECORE_IMF_INPUT_PANEL_STATE_EVENT, _input_panel_state_cb, NULL);
WAIT_FOR_CALLBACK();
ecore_imf_context_input_panel_enabled_set(ctx, EINA_FALSE);
ecore_imf_context_focus_in(ctx);
- timer_exit = ecore_timer_add(WAIT_RESULT_DELAY, _timeout_timer_cb, NULL);
-
ecore_imf_context_input_panel_event_callback_add(ctx, ECORE_IMF_INPUT_PANEL_STATE_EVENT, _input_panel_state_cb, NULL);
WAIT_FOR_CALLBACK();
// no call ecore_evas_show() intentionally for testing
- timer_exit = ecore_timer_add(WAIT_RESULT_DELAY, _timeout_timer_cb, NULL);
-
ecore_imf_context_client_canvas_set(ctx, evas);
ecore_imf_context_focus_in(ctx);
ecore_evas_show(ee);
- timer_exit = ecore_timer_add(WAIT_RESULT_DELAY, _timeout_timer_cb, NULL);
-
ecore_imf_context_client_window_set(ctx, (void *)ecore_evas_window_get(ecore_evas_ecore_evas_get(evas)));
ecore_imf_context_focus_in(ctx);