e_test_event: add functions for check event occured 92/213192/3
authorJunseok, Kim <juns.kim@samsung.com>
Mon, 2 Sep 2019 11:30:06 +0000 (20:30 +0900)
committerJunseok, Kim <juns.kim@samsung.com>
Tue, 3 Sep 2019 08:23:37 +0000 (17:23 +0900)
make event queue is retain during tc running.
And add check event functions.
For check event, use setEventCheckpoint() for save event starting point.
and then, use isEventOccuredAfterCheckpoint() for check event occurence
of the window from checkpoint. if event occured, return will be TRUE.

Change-Id: Ie421c67f4a64204752e768221de4c6e815aee1f4

src/e_test_event.cpp
src/e_test_event.h

index 6efd5ad024973aa24f471bda2c3772037f55739a..2781adb708273b7a0f5df72f762d05f34975874f 100644 (file)
@@ -1109,6 +1109,7 @@ etRunner::waitEvent(etWin *win, E_TC_Event_Type ev_type)
 {
    E_TC_Event_Item *recv_item = NULL;
    Eina_Bool res = EINA_FALSE;
+   Eina_List *l = NULL;
 
    // swap event
    switch (ev_type)
@@ -1153,19 +1154,19 @@ etRunner::waitEvent(etWin *win, E_TC_Event_Type ev_type)
    // pre-waiting events
    work(0.5);
 
-   if (ev.recv_queue == NULL)
+   if (ev.wait_event_index == ev.last_event)
      {
         work(0.5); // waiting additional time
-        if (ev.recv_queue == NULL)
+        if (ev.wait_event_index == ev.last_event)
           return EINA_FALSE;
      }
 
-   EINA_LIST_CAST_FREE(ev.recv_queue, recv_item, E_TC_Event_Item*)
+   EINA_LIST_CAST_FOREACH(ev.recv_queue, l, recv_item, E_TC_Event_Item*)
      {
         if ((recv_item->win == (win?win->native_win:0)) &&
             (recv_item->type == ev_type))
           {
-             ev.recv_queue = eina_list_remove(ev.recv_queue, recv_item);
+             ev.wait_event_index = recv_item;
              res = EINA_TRUE;
              break;
           }
@@ -1193,10 +1194,37 @@ etRunner::insertEventQueue(Ecore_Window id, E_TC_Event_Type ev_type)
    item->win = id;
    item->type = ev_type;
    ev.recv_queue = eina_list_append(ev.recv_queue, item);
+   ev.last_event = item;
 
    return EINA_TRUE;
 }
 
+Eina_Bool
+etRunner::isEventOccuredAfterCheckpoint(etWin *tw, E_TC_Event_Type ev_type)
+{
+   Eina_List *l = NULL;
+   E_TC_Event_Item *item = NULL;
+   Ecore_Window id = tw->native_win;
+
+   EINA_LIST_CAST_FOREACH(ev.recv_queue, l, item, E_TC_Event_Item*)
+     {
+        if (ev.last_checkpoint && ev.last_checkpoint != item)
+          continue;
+
+        if ((item->win == id) && (item->type == ev_type))
+          return EINA_TRUE;
+     }
+
+   return EINA_FALSE;
+}
+
+void
+etRunner::setEventCheckpoint()
+{
+   ev.last_checkpoint = ev.last_event;
+   return;
+}
+
 Eina_Bool
 etRunner::addSignalHandlers()
 {
index f43430ded40d6925f964f34bac616b3b0c1366fe..aa564fd2b2c69654010d862e3954e852d16c3f20 100644 (file)
@@ -72,6 +72,10 @@ public: /* TODO: make it hidden */
         Eina_List *eh_list;
         Eina_List *recv_queue;
 
+        E_TC_Event_Item *wait_event_index;
+        E_TC_Event_Item *last_event;
+        E_TC_Event_Item *last_checkpoint;
+
         struct
           {
              Eina_Stringshare *name;
@@ -172,6 +176,8 @@ public:
 
    void          flushEventQueue();
    Eina_Bool     insertEventQueue(Ecore_Window id, E_TC_Event_Type ev_type);
+   Eina_Bool     isEventOccuredAfterCheckpoint(etWin *tw, E_TC_Event_Type ev_type);
+   void          setEventCheckpoint();
    Eina_Bool     addSignalHandlers();
    void          delSignalHandlers();