e_test_event: check input device info is appropriate 07/321207/3
authorJihoon Kim <jihoon48.kim@samsung.com>
Fri, 29 Nov 2024 04:15:58 +0000 (13:15 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Fri, 29 Nov 2024 04:21:51 +0000 (13:21 +0900)
Change-Id: I8a77862fa633d0312afffc18d61dacd398d95bac
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
src/e_test_event.cpp

index f82cec810d2f732642b636f9fe186b64db731236..d7bf19a82b49610661d6fed9dc0485fce770b8b9 100644 (file)
@@ -2504,6 +2504,32 @@ _cb_work_timeout(void *data)
    return ECORE_CALLBACK_CANCEL;
 }
 
+static Eina_Bool
+checkEvasDeviceInfo(Evas_Device *dev)
+{
+   DBG("[%s] name(%s), description(%s), class(%d), subclass(%d)", __func__, evas_device_name_get(dev), evas_device_description_get(dev), evas_device_class_get(dev), evas_device_subclass_get(dev));
+
+   unsigned int description_len = strlen(evas_device_description_get(dev));
+   unsigned int name_len = strlen(evas_device_name_get(dev));
+   if (description_len > 0 && name_len > 0)
+     return EINA_TRUE;
+
+   return EINA_FALSE;
+}
+
+static Eina_Bool
+checkEcoreDeviceInfo(Ecore_Device *dev)
+{
+   DBG("[%s] name(%s), description(%s), class(%d), subclass(%d)", __func__, ecore_device_name_get(dev), ecore_device_description_get(dev), ecore_device_class_get(dev), evas_device_subclass_get(dev));
+
+   unsigned int description_len = strlen(ecore_device_description_get(dev));
+   unsigned int name_len = strlen(ecore_device_name_get(dev));
+   if (description_len > 0 && name_len > 0)
+     return EINA_TRUE;
+
+   return EINA_FALSE;
+}
+
 /* callbacks - ecore */
 static Eina_Bool
 _cb_ecore_key_down(void *data, int type, void *event)
@@ -2539,7 +2565,10 @@ _cb_ecore_key_up(void *data, int type, void *event)
             type == ECORE_EVENT_KEY_UP)
           {
              runner->ev.key.ecore_state = EINA_FALSE;
-             runner->insertEventQueue(ev->window, E_TC_EVENT_TYPE_INPUT_ECORE_KEY);
+             if (checkEcoreDeviceInfo(ev->dev))
+               runner->insertEventQueue(ev->window, E_TC_EVENT_TYPE_INPUT_ECORE_KEY);
+             else
+               ERR("[Error] Ecore Key Up cb. device info is empty");
           }
      }
 
@@ -2561,9 +2590,14 @@ _cb_ecore_mouse_button_down(void *data, int type, void *event)
         if (runner->ev.mouse.ecore_state == EINA_FALSE &&
             type == ECORE_EVENT_MOUSE_BUTTON_DOWN)
           {
-             DBG("Mouse button DOWN cb. insert event");
-             runner->ev.mouse.ecore_state = EINA_TRUE;
-             runner->insertEventQueue(ev->window, E_TC_EVENT_TYPE_INPUT_ECORE_MOUSE);
+            if (checkEcoreDeviceInfo(ev->dev))
+              {
+                 DBG("Mouse button DOWN cb. insert event");
+                 runner->ev.mouse.ecore_state = EINA_TRUE;
+                 runner->insertEventQueue(ev->window, E_TC_EVENT_TYPE_INPUT_ECORE_MOUSE);
+              }
+            else
+              ERR("[Error] Ecore Mouse button DOWN cb. device info is empty");
           }
      }
 
@@ -2585,9 +2619,14 @@ _cb_ecore_mouse_button_up(void *data, int type, void *event)
         if (runner->ev.mouse.ecore_state == EINA_TRUE &&
             type == ECORE_EVENT_MOUSE_BUTTON_UP)
           {
-             DBG("Mouse button UP cb. insert event");
-             runner->ev.mouse.ecore_state = EINA_FALSE;
-             runner->insertEventQueue(ev->window, E_TC_EVENT_TYPE_INPUT_ECORE_MOUSE);
+             if (checkEcoreDeviceInfo(ev->dev))
+               {
+                  DBG("Mouse button UP cb. insert event");
+                  runner->ev.mouse.ecore_state = EINA_FALSE;
+                  runner->insertEventQueue(ev->window, E_TC_EVENT_TYPE_INPUT_ECORE_MOUSE);
+               }
+             else
+               ERR("[Error] Ecore Mouse button UP cb. device info is empty");
           }
      }
 
@@ -2606,8 +2645,13 @@ _cb_ecore_mouse_move(void *data, int type, void *event)
      {
         if (type == ECORE_EVENT_MOUSE_MOVE)
           {
-             DBG("Mouse MOVE cb. insert event");
-             runner->insertEventQueue(ev->window, E_TC_EVENT_TYPE_INPUT_ECORE_MOUSE);
+             if (checkEcoreDeviceInfo(ev->dev))
+               {
+                  DBG("Mouse MOVE cb. insert event");
+                  runner->insertEventQueue(ev->window, E_TC_EVENT_TYPE_INPUT_ECORE_MOUSE);
+               }
+             else
+               ERR("[Error] Ecore Mouse MOVE cb. device info is empty");
           }
      }
 
@@ -2650,7 +2694,10 @@ _cb_evas_key_up(void * data, Evas * evas, Evas_Object * obj, void * event_info)
              runner->ev.key.evas_state = EINA_FALSE;
              runner->ev.elm_win = NULL;
 
-             runner->insertEventQueue(runner->ev.native_win, E_TC_EVENT_TYPE_INPUT_EVAS_KEY);
+             if (checkEvasDeviceInfo(ev->dev))
+               runner->insertEventQueue(runner->ev.native_win, E_TC_EVENT_TYPE_INPUT_EVAS_KEY);
+             else
+               ERR("[Error] Evas Key Up cb. device info is empty");
           }
      }
    evas_object_event_callback_del(runner->ev.elm_win, EVAS_CALLBACK_KEY_UP, _cb_evas_key_up);