Wait for end of effect animation to get proper window list 02/82502/4
authorMinJeong Kim <minjjj.kim@samsung.com>
Wed, 3 Aug 2016 12:57:14 +0000 (21:57 +0900)
committerMinJeong Kim <minjjj.kim@samsung.com>
Wed, 3 Aug 2016 13:03:53 +0000 (22:03 +0900)
Change-Id: I0bac90e7a48de9287fbe21cb35431bab9ad27400
Signed-off-by: MinJeong Kim <minjjj.kim@samsung.com>
src/0000_easy.c
src/e_test_runner.c
src/e_test_runner.h

index 07a2674..84538fb 100644 (file)
@@ -129,7 +129,7 @@ tc_0011_win_register(E_TC *tc)
 
    EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE);
 
-   tw = e_tc_win_info_add(_WIN_ID, EINA_FALSE, "tc", 0, 0, 1, 1, 0);
+   tw = e_tc_win_info_add(_WIN_ID, EINA_FALSE, EINA_FALSE, "tc", 0, 0, 1, 1, 0);
    EINA_SAFETY_ON_NULL_GOTO(tw, finish);
 
    /* check RegisterWindow method */
index bce4fc3..07c58cb 100644 (file)
@@ -7,6 +7,11 @@ int _log_dom = -1;
 struct tizen_policy *tizen_policy = NULL;
 struct tizen_surface *tizen_surface = NULL;
 
+typedef struct {
+     Eina_List *list;
+     Eina_Bool retry;
+} Window_Info_List;
+
 static void
 _e_test_runner_cb_resource_id(void *data,
                               struct tizen_resource *tizen_resource EINA_UNUSED,
@@ -84,44 +89,56 @@ _cb_method_win_info_list_get(void *data,
    const char *name = NULL, *text = NULL;
    Eldbus_Message_Iter *array, *ec;
    Ecore_Window target_win = 0;
-   Eina_List *list = data;
-   Eina_Bool res;
+   Window_Info_List *info_list = data;
+   Eina_Bool res, animating = EINA_FALSE;
+
+   if (!!!info_list)
+     goto finish;
 
    res = eldbus_message_error_get(msg, &name, &text);
    EINA_SAFETY_ON_TRUE_GOTO(res, finish);
 
-   res = eldbus_message_arguments_get(msg, "ua(usiiiiibb)", &target_win, &array);
+   res = eldbus_message_arguments_get(msg, "ua(usiiiiibbb)", &target_win, &array);
    EINA_SAFETY_ON_FALSE_GOTO(res, finish);
 
    while (eldbus_message_iter_get_and_next(array, 'r', &ec))
      {
         const char *win_name;
         int x, y, w, h, layer;
-        Eina_Bool visible, alpha;
+        Eina_Bool visible, alpha, effect = EINA_FALSE;
         Ecore_Window native_win;
         E_TC_Win *tw = NULL;
 
         res = eldbus_message_iter_arguments_get(ec,
-                                                "usiiiiibb",
-                                                &native_win,
+                                                "usiiiiibbb",
+                                               &native_win,
                                                 &win_name,
                                                 &x,
                                                 &y,
                                                 &w,
                                                 &h,
                                                 &layer,
+                                                &effect,
                                                 &visible,
                                                 &alpha);
+
+        if (effect)
+            animating = EINA_TRUE;
+
         if (!res)
           {
              WRN("Failed to get win info\n");
              continue;
           }
 
-        tw = e_tc_win_info_add(native_win, alpha, win_name, x, y, w, h, layer);
-        list = eina_list_append(list, tw);
+        tw = e_tc_win_info_add(native_win, alpha, effect, win_name, x, y, w, h, layer);
+        info_list->list = eina_list_append(info_list->list, tw);
      }
 
+   if (animating)
+     info_list->retry = EINA_TRUE;
+
+
 finish:
    if ((name) || (text))
      {
@@ -332,21 +349,39 @@ Eina_List *
 e_test_runner_req_win_info_list_get(E_Test_Runner *runner)
 {
    Eldbus_Pending *p;
-   Eina_List *list = NULL;
-   list = eina_list_append(list, NULL);
+   Window_Info_List *info_list = NULL;
 
-   p = eldbus_proxy_call(runner->dbus.proxy,
-                         "GetWindowInfo",
-                         _cb_method_win_info_list_get,
-                         list,
-                         -1,
-                         "");
-   EINA_SAFETY_ON_NULL_RETURN_VAL(p, NULL);
+   info_list = E_NEW(Window_Info_List, 1);
 
-   elm_run();
-   list = eina_list_remove(list, NULL);
+   while (info_list)
+     {
+        p = eldbus_proxy_call(runner->dbus.proxy,
+                              "GetWindowInfo",
+                              _cb_method_win_info_list_get,
+                              info_list,
+                              -1,
+                              "");
+        EINA_SAFETY_ON_NULL_RETURN_VAL(p, NULL);
+
+        elm_run();
+
+        if (info_list->retry)
+          {
+             E_TC_Win *tw;
+             info_list->retry = EINA_FALSE;
+             EINA_LIST_FREE(info_list->list, tw)
+               {
+                  if (tw)
+                    e_tc_win_del(tw);
+               }
+
+             continue;
+          }
+
+        break;
+     }
 
-   return list;
+   return info_list->list;
 }
 
 Eina_Bool
@@ -523,6 +558,7 @@ err:
 E_TC_Win *
 e_tc_win_info_add(Ecore_Window native_win,
                   Eina_Bool alpha,
+                  Eina_Bool animating,
                   const char *name,
                   int x, int y,
                   int w, int h,
@@ -542,6 +578,7 @@ e_tc_win_info_add(Ecore_Window native_win,
    tw->h = h;
    tw->layer = layer;
    tw->alpha = alpha;
+   tw->animating = animating;
 
    return tw;
 }
index 64e6fff..f646489 100644 (file)
@@ -118,6 +118,7 @@ struct _E_TC_Win
    int          layer;      // value of E_Layer
    int          vis;        // visibility
    int          alpha;      // alpha window
+   Eina_Bool    animating;
 };
 
 struct _E_TC
@@ -138,7 +139,7 @@ Eina_Bool  e_test_runner_req_win_stack_set(E_Test_Runner *runner, E_TC_Win *tw,
 Eina_Bool  e_test_runner_ev_wait(E_Test_Runner *runner, E_TC_Event_Type ev);
 
 E_TC_Win  *e_tc_win_add(E_TC_Win *parent, Elm_Win_Type type, Eina_Bool alpha, const char *name, int x, int y, int w, int h, Eina_Bool usr_geom, int layer, E_TC_Win_Color color);
-E_TC_Win  *e_tc_win_info_add(Ecore_Window native_win, Eina_Bool alpha, const char *name, int x, int y, int w, int h, int layer);
+E_TC_Win  *e_tc_win_info_add(Ecore_Window native_win, Eina_Bool alpha, Eina_Bool animating, const char *name, int x, int y, int w, int h, int layer);
 void       e_tc_win_del(E_TC_Win *tw);
 void       e_tc_win_geom_update(E_TC_Win *tw);
 void       e_tc_win_show(E_TC_Win *tw);