diff --git a/src/tests/wayland-test-clients/wayland-test-client-utils.c b/src/tests/wayland-test-clients/wayland-test-client-utils.c index 06c963f52..96c7c273f 100644 --- a/src/tests/wayland-test-clients/wayland-test-client-utils.c +++ b/src/tests/wayland-test-clients/wayland-test-client-utils.c @@ -219,17 +219,19 @@ static const struct wl_registry_listener registry_listener = { }; WaylandDisplay * -wayland_display_new (WaylandDisplayCapabilities capabilities) +wayland_display_new_full (WaylandDisplayCapabilities capabilities, + struct wl_display *wayland_display) { WaylandDisplay *display; + g_assert_nonnull (wayland_display); + display = g_object_new (wayland_display_get_type (), NULL); display->capabilities = capabilities; display->properties = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); - display->display = wl_display_connect (NULL); - g_assert_nonnull (display->display); + display->display = wayland_display; display->registry = wl_display_get_registry (display->display); wl_registry_add_listener (display->registry, ®istry_listener, display); @@ -250,6 +252,13 @@ wayland_display_new (WaylandDisplayCapabilities capabilities) return display; } +WaylandDisplay * +wayland_display_new (WaylandDisplayCapabilities capabilities) +{ + return wayland_display_new_full (capabilities, + wl_display_connect (NULL)); +} + static void wayland_display_finalize (GObject *object) { diff --git a/src/tests/wayland-test-clients/wayland-test-client-utils.h b/src/tests/wayland-test-clients/wayland-test-client-utils.h index 1b926e994..8508ae5a5 100644 --- a/src/tests/wayland-test-clients/wayland-test-client-utils.h +++ b/src/tests/wayland-test-clients/wayland-test-client-utils.h @@ -60,6 +60,9 @@ int create_anonymous_file (off_t size); WaylandDisplay * wayland_display_new (WaylandDisplayCapabilities capabilities); +WaylandDisplay * wayland_display_new_full (WaylandDisplayCapabilities capabilities, + struct wl_display *wayland_display); + WaylandSurface * wayland_surface_new (WaylandDisplay *display, const char *title, int default_width,