refactored codes and added a tizen-ws-shell screensaver TC 77/85277/1
authorGwanglim Lee <gl77.lee@samsung.com>
Wed, 24 Aug 2016 10:48:43 +0000 (19:48 +0900)
committerGwanglim Lee <gl77.lee@samsung.com>
Wed, 24 Aug 2016 10:48:43 +0000 (19:48 +0900)
Change-Id: I58dabc9ad27be8a158ab83722b3d1fa8ed0763ad

configure.ac
packaging/e-tizen-testcase.spec
src/0000_easy.c
src/0400_tzsh.c [new file with mode: 0644]
src/Makefile.am
src/e_test_runner.c
src/e_test_runner.h

index be1c478..238d4af 100644 (file)
@@ -27,7 +27,10 @@ requirements="\
    capi-ui-efl-util \
    wayland-client \
    ecore-wayland \
-   tizen-extension-client"
+   tizen-extension-client \
+   tzsh-screensaver-manager-service \
+   tzsh-screensaver-service \
+   "
 
 PKG_CHECK_MODULES(E_TEST_RUNNER, [${requirements}])
 
index 6fa202a..2742933 100644 (file)
@@ -11,6 +11,8 @@ BuildRequires: pkgconfig(eldbus)
 BuildRequires: pkgconfig(capi-ui-efl-util)
 BuildRequires: gettext
 BuildRequires: pkgconfig(tizen-extension-client)
+BuildRequires: pkgconfig(tzsh-screensaver-manager-service)
+BuildRequires: pkgconfig(tzsh-screensaver-service)
 
 %global TZ_SYS_RO_SHARE  %{?TZ_SYS_RO_SHARE:%TZ_SYS_RO_SHARE}%{!?TZ_SYS_RO_SHARE:/usr/share}
 
index 84538fb..d8b6d08 100644 (file)
@@ -129,9 +129,11 @@ 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, EINA_FALSE, "tc", 0, 0, 1, 1, 0);
+   tw = e_tc_win_info_add();
    EINA_SAFETY_ON_NULL_GOTO(tw, finish);
 
+   tw->native_win = _WIN_ID;
+
    /* check RegisterWindow method */
    res = e_test_runner_req_win_register(tc->runner, tw);
    EINA_SAFETY_ON_FALSE_GOTO(res, finish);
diff --git a/src/0400_tzsh.c b/src/0400_tzsh.c
new file mode 100644 (file)
index 0000000..4fad532
--- /dev/null
@@ -0,0 +1,84 @@
+#include <tzsh_screensaver_manager_service.h>
+#include <tzsh_screensaver_service.h>
+#include "e_test_runner.h"
+
+/* Name:
+ *   [0400] scrsaver basic
+ * Description:
+ *   Check screensaver type window that is shown on the notification layer.
+ * Steps:
+ *   01. Create an elm basic window
+ *   02. Set elm window to be screensaver type using tzsh
+ *   03. Show window
+ *   04. Check window stack
+ * Expected results:
+ *   A window is shown on the notification layer.
+ */
+Eina_Bool
+tc_0400_scrsaver_basic(E_TC *tc)
+{
+   Eina_Bool res = EINA_FALSE;
+   Eina_List *l = NULL, *ll = NULL;
+   E_TC_Win *tw = NULL, *tw2 = NULL;
+   Eina_Bool found = EINA_FALSE;
+
+   tzsh_h tzsh = NULL;
+   tzsh_window tz_win = NULL;
+   tzsh_screensaver_service_h tz_scrsaver = NULL;
+
+   EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE);
+
+   tw = e_tc_win_add(NULL, ELM_WIN_BASIC, EINA_FALSE, NULL,
+                     0, 0, 0, 0, EINA_FALSE,
+                     0, E_TC_WIN_COLOR_RED);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(tw, EINA_FALSE);
+
+   tzsh = tzsh_create(TZSH_TOOLKIT_TYPE_EFL);
+   EINA_SAFETY_ON_NULL_GOTO(tzsh, cleanup);
+
+   tz_win = elm_win_window_id_get(tw->elm_win);
+   EINA_SAFETY_ON_FALSE_GOTO(tz_win, cleanup);
+
+   tz_scrsaver = tzsh_screensaver_service_create(tzsh, tz_win);
+   EINA_SAFETY_ON_NULL_GOTO(tz_scrsaver, cleanup);
+
+   res = e_test_runner_req_win_register(tc->runner, tw);
+   EINA_SAFETY_ON_FALSE_GOTO(res, cleanup);
+
+   e_tc_win_geom_update(tw);
+   e_tc_win_show(tw);
+   e_test_runner_ev_wait(tc->runner, E_TC_EVENT_TYPE_VIS_ON);
+
+   l = e_test_runner_req_win_info_list_get(tc->runner);
+   EINA_SAFETY_ON_NULL_GOTO(l, cleanup);
+
+   EINA_LIST_FOREACH(l, ll, tw2)
+     {
+        if (tw2->layer < 650) break;
+
+        if (tw2->native_win == tw->native_win)
+          {
+             found = EINA_TRUE;
+
+             if (tw2->layer == 650)
+               tc->passed = EINA_TRUE;
+             else
+               EINA_SAFETY_ON_FALSE_GOTO(EINA_FALSE, cleanup);
+
+             break;
+          }
+     }
+
+   EINA_SAFETY_ON_FALSE_GOTO(found, cleanup);
+
+cleanup:
+   e_test_runner_req_win_info_list_free(l);
+   e_tc_win_hide(tw);
+   e_test_runner_req_win_deregister(tc->runner, tw);
+   e_tc_win_del(tw);
+
+   tzsh_screensaver_service_destroy(tz_scrsaver);
+   tzsh_destroy(tzsh);
+
+   return tc->passed;
+}
index 41c8885..bcf0f7e 100644 (file)
@@ -14,7 +14,8 @@ e_test_runner.h \
 0100_base_operation.c \
 0150_base_operation_multi_wins.c \
 0200_transient_for.c \
-0300_notification.c
+0300_notification.c \
+0400_tzsh.c
 
 MAINTAINERCLEANFILES = \
 Makefile.in
index a77c1a0..ed7bc2d 100644 (file)
@@ -98,40 +98,42 @@ _cb_method_win_info_list_get(void *data,
    res = eldbus_message_error_get(msg, &name, &text);
    EINA_SAFETY_ON_TRUE_GOTO(res, finish);
 
-   res = eldbus_message_arguments_get(msg, "ua(usiiiiibbb)", &target_win, &array);
+   res = eldbus_message_arguments_get(msg, "ua(usiiiiibbbiibbbbb)", &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, effect = EINA_FALSE;
-        Ecore_Window native_win;
-        E_TC_Win *tw = NULL;
-
-        res = eldbus_message_iter_arguments_get(ec,
-                                                "usiiiiibbb",
-                                               &native_win,
-                                                &win_name,
-                                                &x,
-                                                &y,
-                                                &w,
-                                                &h,
-                                                &layer,
-                                                &effect,
-                                                &visible,
-                                                &alpha);
-
-        if (effect)
-            animating = EINA_TRUE;
+        E_TC_Win *tw = e_tc_win_info_add();
+        if (!tw) continue;
+
+        res = eldbus_message_iter_arguments_get
+           (ec,
+            "usiiiiibbbiibbbbb",
+            &tw->native_win,
+            &tw->name,
+            &tw->x, &tw->y, &tw->w, &tw->h,
+            &tw->layer,
+            &tw->effect,
+            &tw->vis.win,
+            &tw->vis.obj,
+            &tw->vis.opaque,
+            &tw->vis.type,
+            &tw->vis.skip,
+            &tw->iconic,
+            &tw->alpha,
+            &tw->focus.win,
+            &tw->focus.obj);
+
+        if (tw->effect)
+          animating = EINA_TRUE;
 
         if (!res)
           {
              WRN("Failed to get win info\n");
+             e_tc_win_del(tw);
              continue;
           }
 
-        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);
      }
 
@@ -389,6 +391,17 @@ e_test_runner_req_win_info_list_get(E_Test_Runner *runner)
    return list;
 }
 
+void
+e_test_runner_req_win_info_list_free(Eina_List *l)
+{
+   E_TC_Win *tw;
+
+   EINA_SAFETY_ON_NULL_RETURN(l);
+
+   EINA_LIST_FREE(l, tw)
+     e_tc_win_del(tw);
+}
+
 Eina_Bool
 e_test_runner_ev_wait(E_Test_Runner *runner,
                       E_TC_Event_Type ev)
@@ -462,6 +475,34 @@ e_test_runner_work(void)
    elm_run();
 }
 
+void
+e_test_runner_util_win_info_print(E_Test_Runner *runner)
+{
+   E_TC_Win *tw;
+   Eina_List *l, *ll;
+
+   printf("--------------------------------------------------------------------------------------------------------------------------\n");
+   l = e_test_runner_req_win_info_list_get(runner);
+   EINA_LIST_FOREACH(l, ll, tw)
+     {
+        printf("%04d WinID:%5u alpha:%d %5d,%5d (%5dx%5d) vis(Win:%d Obj:%d Opaque:%2d Type:%2d Skip:%d) Icon:%d Focus(Win:%d Obj:%d)\n",
+               tw->layer,
+               tw->native_win,
+               tw->alpha,
+               tw->x, tw->y, tw->w, tw->h,
+               tw->vis.win,
+               tw->vis.obj,
+               tw->vis.opaque,
+               tw->vis.type,
+               tw->vis.skip,
+               tw->iconic,
+               tw->focus.win,
+               tw->focus.obj);
+     }
+   e_test_runner_req_win_info_list_free(l);
+   printf("--------------------------------------------------------------------------------------------------------------------------\n");
+}
+
 E_TC_Win *
 e_tc_win_add(E_TC_Win *parent,
              Elm_Win_Type type,
@@ -494,35 +535,18 @@ e_tc_win_add(E_TC_Win *parent,
    bg = elm_bg_add(elm_win);
    evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    elm_win_resize_object_add(elm_win, bg);
+
    switch (color)
      {
-      case E_TC_WIN_COLOR_BLACK:
-        elm_bg_color_set(bg, 0, 0, 0);
-        break;
-      case E_TC_WIN_COLOR_WHITE:
-        elm_bg_color_set(bg, 255, 255, 255);
-        break;
-      case E_TC_WIN_COLOR_RED:
-        elm_bg_color_set(bg, 255, 0, 0);
-        break;
-      case E_TC_WIN_COLOR_GREEN:
-        elm_bg_color_set(bg, 0, 255, 0);
-        break;
-      case E_TC_WIN_COLOR_BLUE:
-        elm_bg_color_set(bg, 0, 0, 255);
-        break;
-      case E_TC_WIN_COLOR_YELLOW:
-        elm_bg_color_set(bg, 255, 255, 0);
-        break;
-      case E_TC_WIN_COLOR_CYAN:
-        elm_bg_color_set(bg, 0, 255, 255);
-        break;
-      case E_TC_WIN_COLOR_PURPLE:
-        elm_bg_color_set(bg, 255, 0, 255);
-        break;
-      default:
-        elm_bg_color_set(bg, 255, 0, 0);
-        break;
+      case E_TC_WIN_COLOR_BLACK:  elm_bg_color_set(bg,   0,   0,   0); break;
+      case E_TC_WIN_COLOR_WHITE:  elm_bg_color_set(bg, 255, 255, 255); break;
+      case E_TC_WIN_COLOR_RED:    elm_bg_color_set(bg, 255,   0,   0); break;
+      case E_TC_WIN_COLOR_GREEN:  elm_bg_color_set(bg,   0, 255,   0); break;
+      case E_TC_WIN_COLOR_BLUE:   elm_bg_color_set(bg,   0,   0, 255); break;
+      case E_TC_WIN_COLOR_YELLOW: elm_bg_color_set(bg, 255, 255,   0); break;
+      case E_TC_WIN_COLOR_CYAN:   elm_bg_color_set(bg,   0, 255, 255); break;
+      case E_TC_WIN_COLOR_PURPLE: elm_bg_color_set(bg, 255,   0, 255); break;
+      default:                    elm_bg_color_set(bg, 255,   0,   0); break;
      }
    evas_object_show(bg);
 
@@ -536,17 +560,13 @@ e_tc_win_add(E_TC_Win *parent,
    tw->name = eina_stringshare_add(name);
    if (usr_geom)
      {
-        tw->x = x;
-        tw->y = y;
-        tw->w = w;
-        tw->h = h;
+        tw->x = x; tw->y = y;
+        tw->w = w; tw->h = h;
      }
    else
      {
-        tw->x = 0;
-        tw->y = 0;
-        tw->w = sw;
-        tw->h = sh;
+        tw->x = 0; tw->y = 0;
+        tw->w = sw; tw->h = sh;
      }
    tw->layer = layer;
    tw->alpha = alpha;
@@ -561,30 +581,13 @@ 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,
-                  int layer)
+e_tc_win_info_add(void)
 {
    E_TC_Win *tw = NULL;
 
    tw = E_NEW(E_TC_Win, 1);
    EINA_SAFETY_ON_NULL_RETURN_VAL(tw, NULL);
 
-   tw->elm_win = NULL;
-   tw->native_win = native_win;
-   tw->name = eina_stringshare_add(name);
-   tw->x = x;
-   tw->y = y;
-   tw->w = w;
-   tw->h = h;
-   tw->layer = layer;
-   tw->alpha = alpha;
-   tw->animating = animating;
-
    return tw;
 }
 
@@ -612,12 +615,16 @@ e_tc_win_geom_update(E_TC_Win *tw)
 void
 e_tc_win_show(E_TC_Win *tw)
 {
+   EINA_SAFETY_ON_NULL_RETURN(tw);
+
    evas_object_show(tw->elm_win);
 }
 
 void
 e_tc_win_hide(E_TC_Win *tw)
 {
+   EINA_SAFETY_ON_NULL_RETURN(tw);
+
    evas_object_hide(tw->elm_win);
 }
 
@@ -737,7 +744,9 @@ _e_test_runner_init(E_Test_Runner *runner)
    TC_ADD( 301, "Noti Level 2",                 T_FUNC( 301, notification_level_2      ), 1);
    TC_ADD( 302, "Noti Level 3",                 T_FUNC( 302, notification_level_3      ), 1);
    TC_ADD( 303, "Noti Level Change",            T_FUNC( 303, notification_level_change ), 1);
-   /* TODO */
+
+   /* [0400 - 0499] tizen-ws-shell */
+   TC_ADD( 400, "Screensaver: Basic",           T_FUNC( 400, scrsaver_basic            ), 1);
 #undef T_FUNC
 }
 
index f646489..289a7c6 100644 (file)
@@ -111,14 +111,29 @@ struct _E_Test_Runner
 
 struct _E_TC_Win
 {
-   Evas_Object *elm_win;    // elm_win evas object
-   Ecore_Window native_win; // native window id
-   const char  *name;       // name of client window
-   int          x, y, w, h; // geometry
-   int          layer;      // value of E_Layer
-   int          vis;        // visibility
-   int          alpha;      // alpha window
-   Eina_Bool    animating;
+   Evas_Object      *elm_win;    // elm_win evas object
+   Eina_Bool         animating;
+
+   Ecore_Window      native_win; // native window id
+   const char       *name;       // name of client window
+   int               x, y, w, h; // geometry
+   int               layer;      // value of E_Layer
+   Eina_Bool         effect;
+   struct
+     {
+        Eina_Bool    win;
+        Eina_Bool    obj;
+        int          opaque;
+        int          type;
+        Eina_Bool    skip;
+     } vis;
+   Eina_Bool         iconic;
+   Eina_Bool         alpha;
+   struct
+     {
+        Eina_Bool    win;
+        Eina_Bool    obj;
+     } focus;
 };
 
 struct _E_TC
@@ -135,11 +150,12 @@ struct _E_TC
 Eina_Bool  e_test_runner_req_win_register(E_Test_Runner *runner, E_TC_Win *tw);
 Eina_Bool  e_test_runner_req_win_deregister(E_Test_Runner *runner, E_TC_Win *tw);
 Eina_List *e_test_runner_req_win_info_list_get(E_Test_Runner *runner);
+void       e_test_runner_req_win_info_list_free(Eina_List *l);
 Eina_Bool  e_test_runner_req_win_stack_set(E_Test_Runner *runner, E_TC_Win *tw, E_TC_Win *sibling, Eina_Bool above);
 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, Eina_Bool animating, const char *name, int x, int y, int w, int h, int layer);
+E_TC_Win  *e_tc_win_info_add(void);
 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);
@@ -147,6 +163,9 @@ void       e_tc_win_hide(E_TC_Win *tw);
 Eina_Bool  e_tc_win_transient_for_set(E_TC_Win *tw_parent, E_TC_Win *tw_child, Eina_Bool set);
 void       e_test_runner_work(void);
 
+/* utils */
+void       e_test_runner_util_win_info_print(E_Test_Runner *runner);
+
 /* test cases */
 Eina_Bool  tc_0000_base_pass(E_TC *tc);
 Eina_Bool  tc_0001_base_fail(E_TC *tc);
@@ -185,4 +204,6 @@ Eina_Bool  tc_0301_notification_level_2(E_TC *tc);
 Eina_Bool  tc_0302_notification_level_3(E_TC *tc);
 Eina_Bool  tc_0303_notification_level_change(E_TC *tc);
 
+Eina_Bool  tc_0400_scrsaver_basic(E_TC *tc);
+
 #endif