summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Michael <cp.michael@samsung.com>2019-07-22 09:48:19 -0400
committerChristopher Michael <cp.michael@samsung.com>2019-07-22 09:48:19 -0400
commita526285db4dd281148a8d4ffd347bbc2dec881e3 (patch)
treee8dfb2f16e589cd6fbf0d71336de2d0380a2a887
parent725cce8cb40698a3ac0b8a06ed41b6fbe727b8d9 (diff)
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
-rw-r--r--src/tests/ecore_wl2/ecore_wl2_test_window.c33
1 files changed, 7 insertions, 26 deletions
diff --git a/src/tests/ecore_wl2/ecore_wl2_test_window.c b/src/tests/ecore_wl2/ecore_wl2_test_window.c
index 3f5e98cd50..88c4f7b652 100644
--- a/src/tests/ecore_wl2/ecore_wl2_test_window.c
+++ b/src/tests/ecore_wl2/ecore_wl2_test_window.c
@@ -10,12 +10,13 @@
10 10
11#include "ecore_wl2_suite.h" 11#include "ecore_wl2_suite.h"
12 12
13static Ecore_Wl2_Display *disp;
14
13static Ecore_Wl2_Display * 15static Ecore_Wl2_Display *
14_display_connect(void) 16_display_connect(void)
15{ 17{
16 Ecore_Wl2_Display *disp;
17
18 disp = ecore_wl2_display_connect(NULL); 18 disp = ecore_wl2_display_connect(NULL);
19 ck_assert(disp != NULL);
19 return disp; 20 return disp;
20} 21}
21 22
@@ -30,12 +31,8 @@ _window_create(Ecore_Wl2_Display *disp)
30 31
31EFL_START_TEST(wl2_window_new) 32EFL_START_TEST(wl2_window_new)
32{ 33{
33 Ecore_Wl2_Display *disp;
34 Ecore_Wl2_Window *win; 34 Ecore_Wl2_Window *win;
35 35
36 disp = _display_connect();
37 ck_assert(disp != NULL);
38
39 win = _window_create(disp); 36 win = _window_create(disp);
40 ck_assert(win != NULL); 37 ck_assert(win != NULL);
41} 38}
@@ -43,14 +40,10 @@ EFL_END_TEST
43 40
44EFL_START_TEST(wl2_window_surface_test) 41EFL_START_TEST(wl2_window_surface_test)
45{ 42{
46 Ecore_Wl2_Display *disp;
47 Ecore_Wl2_Window *win; 43 Ecore_Wl2_Window *win;
48 struct wl_surface *surf; 44 struct wl_surface *surf;
49 int id = -1; 45 int id = -1;
50 46
51 disp = _display_connect();
52 ck_assert(disp != NULL);
53
54 win = _window_create(disp); 47 win = _window_create(disp);
55 ck_assert(win != NULL); 48 ck_assert(win != NULL);
56 49
@@ -66,13 +59,9 @@ EFL_END_TEST
66 59
67EFL_START_TEST(wl2_window_rotation_get) 60EFL_START_TEST(wl2_window_rotation_get)
68{ 61{
69 Ecore_Wl2_Display *disp;
70 Ecore_Wl2_Window *win; 62 Ecore_Wl2_Window *win;
71 int rot = -1; 63 int rot = -1;
72 64
73 disp = _display_connect();
74 ck_assert(disp != NULL);
75
76 win = _window_create(disp); 65 win = _window_create(disp);
77 ck_assert(win != NULL); 66 ck_assert(win != NULL);
78 67
@@ -83,13 +72,9 @@ EFL_END_TEST
83 72
84EFL_START_TEST(wl2_window_output_find) 73EFL_START_TEST(wl2_window_output_find)
85{ 74{
86 Ecore_Wl2_Display *disp;
87 Ecore_Wl2_Window *win; 75 Ecore_Wl2_Window *win;
88 Ecore_Wl2_Output *out; 76 Ecore_Wl2_Output *out;
89 77
90 disp = _display_connect();
91 ck_assert(disp != NULL);
92
93 win = _window_create(disp); 78 win = _window_create(disp);
94 ck_assert(win != NULL); 79 ck_assert(win != NULL);
95 80
@@ -100,13 +85,9 @@ EFL_END_TEST
100 85
101EFL_START_TEST(wl2_window_aux_hints_supported_get) 86EFL_START_TEST(wl2_window_aux_hints_supported_get)
102{ 87{
103 Ecore_Wl2_Display *disp;
104 Ecore_Wl2_Window *win; 88 Ecore_Wl2_Window *win;
105 Eina_List *l; 89 Eina_List *l;
106 90
107 disp = _display_connect();
108 ck_assert(disp != NULL);
109
110 win = _window_create(disp); 91 win = _window_create(disp);
111 ck_assert(win != NULL); 92 ck_assert(win != NULL);
112 93
@@ -117,12 +98,8 @@ EFL_END_TEST
117 98
118EFL_START_TEST(wl2_window_display_get) 99EFL_START_TEST(wl2_window_display_get)
119{ 100{
120 Ecore_Wl2_Display *disp;
121 Ecore_Wl2_Window *win; 101 Ecore_Wl2_Window *win;
122 102
123 disp = _display_connect();
124 ck_assert(disp != NULL);
125
126 win = _window_create(disp); 103 win = _window_create(disp);
127 ck_assert(win != NULL); 104 ck_assert(win != NULL);
128 105
@@ -135,6 +112,8 @@ ecore_wl2_test_window(TCase *tc)
135{ 112{
136 if (getenv("WAYLAND_DISPLAY")) 113 if (getenv("WAYLAND_DISPLAY"))
137 { 114 {
115 disp = _display_connect();
116
138 /* window tests can only run if there is an existing compositor */ 117 /* window tests can only run if there is an existing compositor */
139 tcase_add_test(tc, wl2_window_new); 118 tcase_add_test(tc, wl2_window_new);
140 tcase_add_test(tc, wl2_window_surface_test); 119 tcase_add_test(tc, wl2_window_surface_test);
@@ -142,5 +121,7 @@ ecore_wl2_test_window(TCase *tc)
142 tcase_add_test(tc, wl2_window_output_find); 121 tcase_add_test(tc, wl2_window_output_find);
143 tcase_add_test(tc, wl2_window_aux_hints_supported_get); 122 tcase_add_test(tc, wl2_window_aux_hints_supported_get);
144 tcase_add_test(tc, wl2_window_display_get); 123 tcase_add_test(tc, wl2_window_display_get);
124
125 ecore_wl2_display_disconnect(disp);
145 } 126 }
146} 127}