mirror of
https://github.com/brl/mutter.git
synced 2025-06-13 16:59:30 +00:00
main: Add test initialization function
Since Clutter's backend relies on MetaBackend now, initialzation has to go through meta_init(), both in mutter and in gnome-shell. However the compositor enum and backend gtype used to enforce the environment used for tests are private, so instead expose a test initialization function that can be used from both mutter and gnome-shell. https://gitlab.gnome.org/GNOME/mutter/merge_requests/750
This commit is contained in:

committed by
Jonas Ådahl

parent
556e7694de
commit
dc9c5417bc
@ -87,6 +87,7 @@
|
||||
#ifdef HAVE_WAYLAND
|
||||
#include "backends/x11/nested/meta-backend-x11-nested.h"
|
||||
#include "wayland/meta-wayland.h"
|
||||
#include "wayland/meta-xwayland.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_NATIVE_BACKEND
|
||||
@ -741,3 +742,22 @@ meta_get_x11_display_policy (void)
|
||||
|
||||
return META_DISPLAY_POLICY_MANDATORY;
|
||||
}
|
||||
|
||||
void
|
||||
meta_test_init (void)
|
||||
{
|
||||
#if defined(HAVE_WAYLAND)
|
||||
g_autofree char *display_name = g_strdup ("mutter-test-display-XXXXXX");
|
||||
int fd = g_mkstemp (display_name);
|
||||
|
||||
meta_override_compositor_configuration (META_COMPOSITOR_TYPE_WAYLAND,
|
||||
META_TYPE_BACKEND_X11_NESTED);
|
||||
meta_wayland_override_display_name (display_name);
|
||||
meta_xwayland_override_display_number (512 + rand() % 512);
|
||||
meta_init ();
|
||||
|
||||
close (fd);
|
||||
#else
|
||||
g_error ("Tests require wayland support");
|
||||
#endif
|
||||
}
|
||||
|
Reference in New Issue
Block a user