tests: Add input_panel_enabled_set and ecore_imf_context_del unittest 60/244960/1
authorJihoon Kim <jihoon48.kim@samsung.com>
Mon, 28 Sep 2020 08:56:42 +0000 (17:56 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Mon, 28 Sep 2020 08:56:42 +0000 (17:56 +0900)
Change-Id: I8087165d81785eff958b05b937959a8b075253a4
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
ism/tests/Makefile.am
ism/tests/ecore_imf_tests.cpp
ism/tests/main.cpp

index 5045b73..5b74784 100644 (file)
@@ -32,12 +32,14 @@ isf_tests_CXXFLAGS = @GMOCK_CFLAGS@ \
                      @ECORE_IMF_CFLAGS@ \
                      @ECORE_EVAS_CFLAGS@ \
                      @EVAS_CFLAGS@ \
+                     @VCONF_CFLAGS@ \
                      -fPIE
 
 isf_tests_LDFLAGS  = @GMOCK_LIBS@ -rpath $(libdir)\
                      @ECORE_IMF_LIBS@ \
                      @ECORE_EVAS_LIBS@ \
                      @EVAS_LIBS@ \
+                     @VCONF_LIBS@ \
                      -pie
 
 isf_tests_LDADD    =
index 14020da..0f4ceb4 100644 (file)
@@ -26,6 +26,7 @@
 #include <Ecore_Evas.h>
 #include <Evas.h>
 #include <Ecore.h>
+#include <vconf.h>
 
 #define WIDTH 480
 #define HEIGHT 800
@@ -41,6 +42,40 @@ static Ecore_IMF_Input_Panel_State input_panel_state = ECORE_IMF_INPUT_PANEL_STA
 static void STOP_LOOP();
 static void WAIT_FOR_CALLBACK();
 
+static void input_panel_state_changed_cb(keynode_t *key, void* data)
+{
+    if (!key) return;
+
+    int sip_status = vconf_keynode_get_int (key);
+
+    switch (sip_status) {
+        case VCONFKEY_ISF_INPUT_PANEL_STATE_HIDE:
+            printf("state : hide\n");
+            break;
+        case VCONFKEY_ISF_INPUT_PANEL_STATE_WILL_HIDE:
+            printf("state : will_hide\n");
+            break;
+        case VCONFKEY_ISF_INPUT_PANEL_STATE_SHOW:
+            printf("state : show\n");
+            break;
+        case VCONFKEY_ISF_INPUT_PANEL_STATE_WILL_SHOW:
+            printf("state : will_show\n");
+            break;
+        default :
+            printf("sip_status error!\n");
+            break;
+    }
+
+    callback_called = true;
+
+    if (timer_exit) {
+        ecore_timer_del(timer_exit);
+        timer_exit = NULL;
+    }
+
+    STOP_LOOP();
+}
+
 class EcoreIMFContextTest : public testing::Test {
     public:
         virtual void SetUp() {
@@ -265,6 +300,22 @@ TEST_F(EcoreIMFContextWinFocusTest, utc_ime_disable)
     EXPECT_EQ(input_panel_state, ECORE_IMF_INPUT_PANEL_STATE_HIDE);
 }
 
+TEST_F(EcoreIMFContextWinFocusTest, utc_ime_disable_show)
+{
+    ecore_imf_context_input_panel_enabled_set(ctx, EINA_FALSE);
+    ecore_imf_context_focus_in(ctx);
+    ecore_imf_context_input_panel_show(ctx);
+
+    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_Input_Panel_State input_panel_state = ecore_imf_context_input_panel_state_get(ctx);
+
+    EXPECT_EQ(callback_called, true);
+    EXPECT_EQ(input_panel_state, ECORE_IMF_INPUT_PANEL_STATE_SHOW);
+}
+
 TEST_F(EcoreIMFContextWinTest, utc_ime_show_in_canvas_no_window_show)
 {
     callback_called = false;
@@ -302,4 +353,31 @@ TEST_F(EcoreIMFContextWinFocusTest, utc_ime_show_in_client_window)
     EXPECT_EQ(input_panel_state, ECORE_IMF_INPUT_PANEL_STATE_SHOW);
 }
 
+TEST_F(EcoreIMFContextWinFocusTest, utc_ime_show_and_context_delete)
+{
+    ecore_imf_context_focus_in(ctx);
+
+    ecore_imf_context_input_panel_event_callback_add(ctx, ECORE_IMF_INPUT_PANEL_STATE_EVENT, _input_panel_state_cb, NULL);
+
+    WAIT_FOR_CALLBACK();
+
+    EXPECT_EQ(callback_called, true);
+    EXPECT_EQ(input_panel_state, ECORE_IMF_INPUT_PANEL_STATE_SHOW);
+
+    callback_called = false;
+    ecore_imf_context_del(ctx);
+    ctx = nullptr;
+
+    vconf_notify_key_changed(VCONFKEY_ISF_INPUT_PANEL_STATE, input_panel_state_changed_cb, NULL);
+
+    WAIT_FOR_CALLBACK();
+
+    int vconf_input_panel_state;
+    int ret = vconf_get_int(VCONFKEY_ISF_INPUT_PANEL_STATE, &vconf_input_panel_state);
+    EXPECT_EQ(ret, 0);
+    EXPECT_EQ(vconf_input_panel_state, VCONFKEY_ISF_INPUT_PANEL_STATE_HIDE);
+
+    vconf_ignore_key_changed(VCONFKEY_ISF_INPUT_PANEL_STATE, input_panel_state_changed_cb);
+}
+
 } // namespace
index a37d671..d309318 100644 (file)
@@ -2,6 +2,7 @@
 #include <gmock/gmock.h>
 
 int main(int argc, char** argv) {
+    printf("Please remove lockscreen\n");
     testing::InitGoogleTest(&argc, argv);
     return RUN_ALL_TESTS();
 }