From 11bb4600cdd1cee95081ae0aa25e9ad2c0d9bada Mon Sep 17 00:00:00 2001 From: "JunSeok, Kim" Date: Thu, 31 May 2018 12:38:54 +0900 Subject: [PATCH] e_test_event: add generateTouch methods using inputGenerator Change-Id: I8ba57a9627cf17b1ad1a33b1c028858cec6f61ac --- src/e_test_event.cpp | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++++ src/e_test_event.h | 6 +++- 2 files changed, 89 insertions(+), 1 deletion(-) diff --git a/src/e_test_event.cpp b/src/e_test_event.cpp index 398e26d..ac43eff 100644 --- a/src/e_test_event.cpp +++ b/src/e_test_event.cpp @@ -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; diff --git a/src/e_test_event.h b/src/e_test_event.h index 20aeb67..496bb63 100644 --- a/src/e_test_event.h +++ b/src/e_test_event.h @@ -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__ -- 2.7.4