Revert "tests: integrate timeout timer and begin main loop" 57/244957/1
authorJihoon Kim <jihoon48.kim@samsung.com>
Mon, 28 Sep 2020 08:49:18 +0000 (17:49 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Mon, 28 Sep 2020 08:49:26 +0000 (17:49 +0900)
This reverts commit 62bc8f4f1d3ef20fccdd6bfc737d8218b8eefd87.

Change-Id: I4065e872f87f9f2193e3d7e6999807041a8e0de2

ism/tests/ecore_imf_tests.cpp

index cb05b93..6e13a60 100644 (file)
@@ -34,7 +34,6 @@
 
 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;
 
@@ -43,6 +42,8 @@ static void WAIT_FOR_CALLBACK();
 
 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);
@@ -68,6 +69,7 @@ class EcoreIMFContextWinTest : public testing::Test {
         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);
@@ -104,13 +106,12 @@ class EcoreIMFContextWinTest : public testing::Test {
 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;
 
@@ -128,11 +129,6 @@ static void _input_panel_state_cb(void *data, Ecore_IMF_Context *ctx, int value)
 
     callback_called = true;
 
-    if (timer_exit) {
-        ecore_timer_del(timer_exit);
-        timer_exit = NULL;
-    }
-
     STOP_LOOP();
 }
 
@@ -143,12 +139,6 @@ static void 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();
 }
 
@@ -194,6 +184,8 @@ TEST_F(EcoreIMFContextWinTest, utc_ime_show_in_canvas)
     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();
@@ -220,6 +212,8 @@ TEST_F(EcoreIMFContextWinTest, utc_ime_disable_show)
     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();
@@ -242,6 +236,8 @@ TEST_F(EcoreIMFContextWinTest, utc_ime_show_in_canvas_no_window_show)
 
     // 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);
 
@@ -265,6 +261,8 @@ TEST_F(EcoreIMFContextWinTest, utc_ime_show_in_client_window)
 
     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);