tests/ecore_wl2: Add test cases for wl2 client-side functions
authorChristopher Michael <cp.michael@samsung.com>
Mon, 15 Jul 2019 14:28:29 +0000 (10:28 -0400)
committerTaehyub Kim <taehyub.kim@samsung.com>
Wed, 17 Jul 2019 07:54:06 +0000 (16:54 +0900)
This patch separates the ecore_wl2 tests to support both server-side
and client-side functionality. In order to test client-side functions,
these tests MUST be run under an existing Wayland Compositor
(Enlightenment, Weston, etc).

ref T8016

src/tests/ecore_wl2/ecore_wl2_test_display.c
src/tests/ecore_wl2/ecore_wl2_tests_helpers.h

index 5806d00..c79621a 100644 (file)
@@ -55,11 +55,42 @@ EFL_START_TEST(wl2_display_name_get)
 }
 EFL_END_TEST
 
+EFL_START_TEST(wl2_display_connect)
+{
+   Ecore_Wl2_Display *disp;
+
+   disp = ECORE_WL2_TEST_DISPLAY_CONNECT();
+   ck_assert(disp != NULL);
+}
+EFL_END_TEST
+
+EFL_START_TEST(wl2_display_disconnect)
+{
+   Ecore_Wl2_Display *disp;
+
+   disp = ECORE_WL2_TEST_DISPLAY_CONNECT();
+   ck_assert(disp != NULL);
+
+   ecore_wl2_display_disconnect(disp);
+}
+EFL_END_TEST
+
 void
 ecore_wl2_test_display(TCase *tc)
 {
-   tcase_add_test(tc, wl2_display_create);
-   tcase_add_test(tc, wl2_display_destroy);
-   tcase_add_test(tc, wl2_display_get);
-   tcase_add_test(tc, wl2_display_name_get);
+   if (!getenv("WAYLAND_DISPLAY"))
+     {
+        /* tests here are for server-side functions */
+        tcase_add_test(tc, wl2_display_create);
+        tcase_add_test(tc, wl2_display_destroy);
+        tcase_add_test(tc, wl2_display_get);
+        tcase_add_test(tc, wl2_display_name_get);
+     }
+
+   if (getenv("WAYLAND_DISPLAY"))
+     {
+        /* tests here are for client-side functions */
+        tcase_add_test(tc, wl2_display_connect);
+        tcase_add_test(tc, wl2_display_disconnect);
+     }
 }
index 24175a5..e06cea7 100644 (file)
@@ -4,6 +4,7 @@
 # include <Ecore_Wl2.h>
 
 # define ECORE_WL2_TEST_DISPLAY_SETUP() _setup_display()
+# define ECORE_WL2_TEST_DISPLAY_CONNECT() _connect_display()
 
 static Ecore_Wl2_Display *
 _setup_display(void)
@@ -14,4 +15,13 @@ _setup_display(void)
    return disp;
 }
 
+static Ecore_Wl2_Display *
+_connect_display(void)
+{
+   Ecore_Wl2_Display *disp;
+
+   disp = ecore_wl2_display_connect(NULL);
+   return disp;
+}
+
 #endif