tests/ecore_wl2: Reduce calls to ecore_wl2_display_connect

In order to reduce display setup time during test execution, we can
just connect once and run all the window tests after that.

ref T8016
This commit is contained in:
Christopher Michael 2019-07-22 09:48:19 -04:00
parent 725cce8cb4
commit a526285db4
1 changed files with 7 additions and 26 deletions

View File

@ -10,12 +10,13 @@
#include "ecore_wl2_suite.h"
static Ecore_Wl2_Display *disp;
static Ecore_Wl2_Display *
_display_connect(void)
{
Ecore_Wl2_Display *disp;
disp = ecore_wl2_display_connect(NULL);
ck_assert(disp != NULL);
return disp;
}
@ -30,12 +31,8 @@ _window_create(Ecore_Wl2_Display *disp)
EFL_START_TEST(wl2_window_new)
{
Ecore_Wl2_Display *disp;
Ecore_Wl2_Window *win;
disp = _display_connect();
ck_assert(disp != NULL);
win = _window_create(disp);
ck_assert(win != NULL);
}
@ -43,14 +40,10 @@ EFL_END_TEST
EFL_START_TEST(wl2_window_surface_test)
{
Ecore_Wl2_Display *disp;
Ecore_Wl2_Window *win;
struct wl_surface *surf;
int id = -1;
disp = _display_connect();
ck_assert(disp != NULL);
win = _window_create(disp);
ck_assert(win != NULL);
@ -66,13 +59,9 @@ EFL_END_TEST
EFL_START_TEST(wl2_window_rotation_get)
{
Ecore_Wl2_Display *disp;
Ecore_Wl2_Window *win;
int rot = -1;
disp = _display_connect();
ck_assert(disp != NULL);
win = _window_create(disp);
ck_assert(win != NULL);
@ -83,13 +72,9 @@ EFL_END_TEST
EFL_START_TEST(wl2_window_output_find)
{
Ecore_Wl2_Display *disp;
Ecore_Wl2_Window *win;
Ecore_Wl2_Output *out;
disp = _display_connect();
ck_assert(disp != NULL);
win = _window_create(disp);
ck_assert(win != NULL);
@ -100,13 +85,9 @@ EFL_END_TEST
EFL_START_TEST(wl2_window_aux_hints_supported_get)
{
Ecore_Wl2_Display *disp;
Ecore_Wl2_Window *win;
Eina_List *l;
disp = _display_connect();
ck_assert(disp != NULL);
win = _window_create(disp);
ck_assert(win != NULL);
@ -117,12 +98,8 @@ EFL_END_TEST
EFL_START_TEST(wl2_window_display_get)
{
Ecore_Wl2_Display *disp;
Ecore_Wl2_Window *win;
disp = _display_connect();
ck_assert(disp != NULL);
win = _window_create(disp);
ck_assert(win != NULL);
@ -135,6 +112,8 @@ ecore_wl2_test_window(TCase *tc)
{
if (getenv("WAYLAND_DISPLAY"))
{
disp = _display_connect();
/* window tests can only run if there is an existing compositor */
tcase_add_test(tc, wl2_window_new);
tcase_add_test(tc, wl2_window_surface_test);
@ -142,5 +121,7 @@ ecore_wl2_test_window(TCase *tc)
tcase_add_test(tc, wl2_window_output_find);
tcase_add_test(tc, wl2_window_aux_hints_supported_get);
tcase_add_test(tc, wl2_window_display_get);
ecore_wl2_display_disconnect(disp);
}
}