e_test_efl_util: Add working timer in deinitializer of etInputGenHandler 76/313176/1
authorJunseok Kim <juns.kim@samsung.com>
Thu, 20 Jun 2024 01:47:55 +0000 (10:47 +0900)
committerJunseok Kim <juns.kim@samsung.com>
Thu, 20 Jun 2024 01:48:02 +0000 (10:48 +0900)
The Input generator sometimes need more time to deinitialize themself.
For avoid these failure, Add timer in deinitializer of etInputGenHandler.

Change-Id: Ied73fda5bc8d0c40b8d59d0a03f0c501aeae4d87

src/e_test_efl_util.cpp
src/e_test_efl_util.h

index 54223344806a17cc4208b2c5ab8f427b1d067c84..cd7ddb8c9cda2584c1eef63739c2517c1ae7405c 100644 (file)
@@ -1,3 +1,4 @@
+#include "e_test_event.h"
 #include "e_test_efl_util.h"
 
 static const char*
@@ -20,6 +21,50 @@ printErrorCode(int ret)
   }
 }
 
+etInputGenHandler::etInputGenHandler(efl_util_input_device_type_e type) :
+handler(nullptr)
+{
+  if (type == EFL_UTIL_INPUT_DEVTYPE_TOUCHSCREEN)
+    {
+        int ret = EFL_UTIL_ERROR_NONE;
+        ret = efl_util_input_set_touch_count(10);
+        if (ret != EFL_UTIL_ERROR_NONE)
+          printf("failed to set touch count: (ret: %d)", ret);
+    }
+
+  handler = efl_util_input_initialize_generator_with_name(type, NULL);
+
+  if (handler == nullptr)
+    printf("failed to init input generator\n");
+}
+
+etInputGenHandler::etInputGenHandler(efl_util_input_device_type_e type, bool with_sync) :
+handler(nullptr)
+{
+  if (type == EFL_UTIL_INPUT_DEVTYPE_TOUCHSCREEN)
+    {
+        int ret = EFL_UTIL_ERROR_NONE;
+        ret = efl_util_input_set_touch_count(10);
+        if (ret != EFL_UTIL_ERROR_NONE)
+          printf("failed to set touch count: (ret: %d)", ret);
+    }
+
+  if (with_sync)
+    handler = efl_util_input_initialize_generator_with_sync(type, NULL);
+  else
+    handler = efl_util_input_initialize_generator_with_name(type, NULL);
+
+  if (handler == nullptr)
+    printf("failed to init input generator\n");
+}
+
+etInputGenHandler::~etInputGenHandler()
+{
+  efl_util_input_deinitialize_generator(handler);
+  etRunner::get().work(0.5);
+  handler = nullptr;
+}
+
 Eina_Bool
 etInputGenHandler::generateMouseDown(int x, int y)
 {
index fdcb97c9a82b6f6a0d3815a0285c8338bc9ab9ff..9c5d25ba9072a7bb6678a3773bf170ae3d6ae59e 100644 (file)
@@ -9,46 +9,9 @@ class etInputGenHandler
 {
  public :
    etInputGenHandler() = delete;
-   etInputGenHandler(efl_util_input_device_type_e type) :
-   handler(nullptr)
-   {
-      if (type == EFL_UTIL_INPUT_DEVTYPE_TOUCHSCREEN)
-        {
-           int ret = EFL_UTIL_ERROR_NONE;
-           ret = efl_util_input_set_touch_count(10);
-           if (ret != EFL_UTIL_ERROR_NONE)
-             printf("failed to set touch count: (ret: %d)", ret);
-        }
-
-      handler = efl_util_input_initialize_generator_with_name(type, NULL);
-
-      if (handler == nullptr)
-        printf("failed to init input generator\n");
-   }
-   etInputGenHandler(efl_util_input_device_type_e type, bool with_sync) :
-   handler(nullptr)
-   {
-      if (type == EFL_UTIL_INPUT_DEVTYPE_TOUCHSCREEN)
-        {
-           int ret = EFL_UTIL_ERROR_NONE;
-           ret = efl_util_input_set_touch_count(10);
-           if (ret != EFL_UTIL_ERROR_NONE)
-             printf("failed to set touch count: (ret: %d)", ret);
-        }
-
-      if (with_sync)
-        handler = efl_util_input_initialize_generator_with_sync(type, NULL);
-      else
-        handler = efl_util_input_initialize_generator_with_name(type, NULL);
-
-      if (handler == nullptr)
-        printf("failed to init input generator\n");
-   }
-   ~etInputGenHandler()
-   {
-      efl_util_input_deinitialize_generator(handler);
-      handler = nullptr;
-   }
+   etInputGenHandler(efl_util_input_device_type_e type);
+   etInputGenHandler(efl_util_input_device_type_e type, bool with_sync);
+   ~etInputGenHandler();
 
    efl_util_inputgen_h getHandler() { return handler; }