e_test_event: add generateTouch methods using inputGenerator 75/180575/2
authorJunSeok, Kim <juns.kim@samsung.com>
Thu, 31 May 2018 03:38:54 +0000 (12:38 +0900)
committerJunSeok, Kim <juns.kim@samsung.com>
Thu, 31 May 2018 04:29:26 +0000 (13:29 +0900)
Change-Id: I8ba57a9627cf17b1ad1a33b1c028858cec6f61ac

src/e_test_event.cpp
src/e_test_event.h

index 398e26d..ac43eff 100644 (file)
@@ -81,6 +81,9 @@ etRunner::init()
    res = resetRegisterWin();
    EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EINA_FALSE);
 
+   // init input generator
+   inputGenerator = efl_util_input_initialize_generator(EFL_UTIL_INPUT_DEVTYPE_TOUCHSCREEN);
+
    return EINA_TRUE;
 }
 
@@ -109,6 +112,9 @@ etRunner::shutdown()
    eldbus_object_unref(dbus.obj);
    eldbus_connection_unref(dbus.conn);
    eldbus_shutdown();
+
+   // deinit input generator
+   efl_util_input_deinitialize_generator(inputGenerator);
 }
 
 Eina_Bool
@@ -554,6 +560,84 @@ etRunner::feedKeyUp(const char *key)
 }
 
 Eina_Bool
+etRunner::generateMouseDown(int x, int y)
+{
+   // Using efl_util_input_generate instead of generate event by eldbus
+   int ret = EFL_UTIL_ERROR_NONE;
+
+   if (inputGenerator == NULL)
+     {
+        inputGenerator = efl_util_input_initialize_generator(EFL_UTIL_INPUT_DEVTYPE_TOUCHSCREEN);
+        work();
+     }
+
+   ret = efl_util_input_generate_touch(inputGenerator,
+                                       0,
+                                       EFL_UTIL_INPUT_TOUCH_BEGIN,
+                                       x, y);
+   if (ret != EFL_UTIL_ERROR_NONE)
+     {
+        efl_util_input_deinitialize_generator(inputGenerator);
+        inputGenerator = NULL;
+        return EINA_FALSE;
+     }
+
+   return EINA_TRUE;
+}
+
+Eina_Bool
+etRunner::generateMouseMove(int x, int y)
+{
+   // Using efl_util_input_generate instead of generate event by eldbus
+   int ret = EFL_UTIL_ERROR_NONE;
+
+   if (inputGenerator == NULL)
+     {
+        inputGenerator = efl_util_input_initialize_generator(EFL_UTIL_INPUT_DEVTYPE_TOUCHSCREEN);
+        work();
+     }
+
+   ret = efl_util_input_generate_touch(inputGenerator,
+                                       0,
+                                       EFL_UTIL_INPUT_TOUCH_UPDATE,
+                                       x, y);
+   if (ret != EFL_UTIL_ERROR_NONE)
+     {
+        efl_util_input_deinitialize_generator(inputGenerator);
+        inputGenerator = NULL;
+        return EINA_FALSE;
+     }
+
+   return EINA_TRUE;
+}
+
+Eina_Bool
+etRunner::generateMouseUp(int x, int y)
+{
+   // Using efl_util_input_generate instead of generate event by eldbus
+   int ret = EFL_UTIL_ERROR_NONE;
+
+   if (inputGenerator == NULL)
+     {
+        inputGenerator = efl_util_input_initialize_generator(EFL_UTIL_INPUT_DEVTYPE_TOUCHSCREEN);
+        work();
+     }
+
+   ret = efl_util_input_generate_touch(inputGenerator,
+                                       0,
+                                       EFL_UTIL_INPUT_TOUCH_END,
+                                       x, y);
+   if (ret != EFL_UTIL_ERROR_NONE)
+     {
+        efl_util_input_deinitialize_generator(inputGenerator);
+        inputGenerator = NULL;
+        return EINA_FALSE;
+     }
+
+   return EINA_TRUE;
+}
+
+Eina_Bool
 etRunner::freezeEvent()
 {
    Eldbus_Pending *p = NULL;
index 20aeb67..496bb63 100644 (file)
@@ -94,6 +94,9 @@ public:
    Eina_Bool     feedMouseUp(int x, int y);
    Eina_Bool     feedKeyDown(const char *key);
    Eina_Bool     feedKeyUp(const char *key);
+   Eina_Bool     generateMouseDown(int x, int y);
+   Eina_Bool     generateMouseMove(int x, int y);
+   Eina_Bool     generateMouseUp(int x, int y);
    Eina_Bool     freezeEvent();
    Eina_Bool     thawEvent();
    Eina_Bool     waitEvent(E_TC_Event_Type ev);
@@ -103,7 +106,8 @@ public:
    int            getLogDomain()  { return logDomain;  }
 
 protected:
-    Eina_Bool initProtocols();
+   Eina_Bool initProtocols();
+   efl_util_inputgen_h inputGenerator = NULL;
 };
 
 #endif // end of __ET_EVENT_LOOP_H__