tests/ecore_wl2: Add test cases for wl2 client-side functions

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
This commit is contained in:
Christopher Michael 2019-07-15 10:28:29 -04:00
parent b9f89fabb6
commit 723412404f
2 changed files with 45 additions and 4 deletions

View 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);
}
}

View 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