mirror of
https://github.com/brl/mutter.git
synced 2024-11-24 17:10:40 -05:00
context/test: Add 'no-x11' and 'test-client' constructor flags
The 'no-x11' one will inhibit Xwayland from starting, and 'test-client' will make sure the test client path is properly discovered. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>
This commit is contained in:
parent
07384e18c5
commit
2f19a5f28d
@ -170,7 +170,8 @@ main (int argc, char *argv[])
|
||||
{
|
||||
g_autoptr (MetaContext) context = NULL;
|
||||
|
||||
context = meta_create_test_context (META_CONTEXT_TEST_TYPE_NESTED);
|
||||
context = meta_create_test_context (META_CONTEXT_TEST_TYPE_NESTED,
|
||||
META_CONTEXT_TEST_FLAG_NO_X11);
|
||||
g_assert (meta_context_configure (context, &argc, &argv, NULL));
|
||||
|
||||
init_tests ();
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include <glib.h>
|
||||
#include <gio/gio.h>
|
||||
|
||||
#include "core/main-private.h"
|
||||
#include "tests/meta-backend-test.h"
|
||||
#include "tests/test-utils.h"
|
||||
#include "wayland/meta-wayland.h"
|
||||
@ -49,6 +50,7 @@ struct _MetaContextTest
|
||||
GObject parent;
|
||||
|
||||
MetaContextTestType type;
|
||||
MetaContextTestFlag flags;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (MetaContextTest, meta_context_test, META_TYPE_CONTEXT)
|
||||
@ -59,6 +61,7 @@ meta_context_test_configure (MetaContext *context,
|
||||
char ***argv,
|
||||
GError **error)
|
||||
{
|
||||
MetaContextTest *context_test = META_CONTEXT_TEST (context);
|
||||
MetaContextClass *context_class =
|
||||
META_CONTEXT_CLASS (meta_context_test_parent_class);
|
||||
const char *plugin_name;
|
||||
@ -69,6 +72,7 @@ meta_context_test_configure (MetaContext *context,
|
||||
g_test_init (argc, argv, NULL);
|
||||
g_test_bug_base ("https://gitlab.gnome.org/GNOME/mutter/issues/");
|
||||
|
||||
if (context_test->flags & META_CONTEXT_TEST_FLAG_TEST_CLIENT)
|
||||
meta_ensure_test_client_path (*argc, *argv);
|
||||
|
||||
meta_wayland_override_display_name ("mutter-test-display");
|
||||
@ -224,7 +228,8 @@ meta_context_test_run_tests (MetaContextTest *context_test)
|
||||
}
|
||||
|
||||
MetaContext *
|
||||
meta_create_test_context (MetaContextTestType type)
|
||||
meta_create_test_context (MetaContextTestType type,
|
||||
MetaContextTestFlag flags)
|
||||
{
|
||||
MetaContextTest *context_test;
|
||||
|
||||
@ -232,6 +237,12 @@ meta_create_test_context (MetaContextTestType type)
|
||||
"name", "Mutter Test",
|
||||
NULL);
|
||||
context_test->type = type;
|
||||
context_test->flags = flags;
|
||||
|
||||
/* NOTE: This will be removed in a follow up commit, but is needed
|
||||
* until the override method is replaced. */
|
||||
if (flags & META_CONTEXT_TEST_FLAG_NO_X11)
|
||||
meta_override_x11_display_policy (META_X11_DISPLAY_POLICY_DISABLED);
|
||||
|
||||
return META_CONTEXT (context_test);
|
||||
}
|
||||
|
@ -31,12 +31,21 @@ typedef enum _MetaContextTestType
|
||||
META_CONTEXT_TEST_TYPE_NESTED,
|
||||
} MetaContextTestType;
|
||||
|
||||
typedef enum _MetaContextTestFlag
|
||||
{
|
||||
META_CONTEXT_TEST_FLAG_NONE = 0,
|
||||
META_CONTEXT_TEST_FLAG_TEST_CLIENT = 1 << 0,
|
||||
META_CONTEXT_TEST_FLAG_NO_X11 = 1 << 1,
|
||||
} MetaContextTestFlag;
|
||||
|
||||
#define META_TYPE_CONTEXT_TEST (meta_context_test_get_type ())
|
||||
G_DECLARE_FINAL_TYPE (MetaContextTest, meta_context_test,
|
||||
META, CONTEXT_TEST,
|
||||
MetaContext)
|
||||
|
||||
MetaContext * meta_create_test_context (MetaContextTestType type);
|
||||
MetaContext * meta_create_test_context (MetaContextTestType type,
|
||||
MetaContextTestFlag flags);
|
||||
|
||||
|
||||
int meta_context_test_run_tests (MetaContextTest *context_test);
|
||||
|
||||
|
@ -37,7 +37,8 @@ main (int argc,
|
||||
{
|
||||
g_autoptr (MetaContext) context = NULL;
|
||||
|
||||
context = meta_create_test_context (META_CONTEXT_TEST_TYPE_HEADLESS);
|
||||
context = meta_create_test_context (META_CONTEXT_TEST_TYPE_HEADLESS,
|
||||
META_CONTEXT_TEST_FLAG_NO_X11);
|
||||
g_assert (meta_context_configure (context, &argc, &argv, NULL));
|
||||
|
||||
init_tests ();
|
||||
|
@ -133,7 +133,8 @@ main (int argc,
|
||||
{
|
||||
g_autoptr (MetaContext) context = NULL;
|
||||
|
||||
context = meta_create_test_context (META_CONTEXT_TEST_TYPE_HEADLESS);
|
||||
context = meta_create_test_context (META_CONTEXT_TEST_TYPE_HEADLESS,
|
||||
META_CONTEXT_TEST_FLAG_NO_X11);
|
||||
g_assert (meta_context_configure (context, &argc, &argv, NULL));
|
||||
|
||||
init_ref_test_sanity_tests ();
|
||||
|
@ -1161,7 +1161,8 @@ main (int argc, char *argv[])
|
||||
{
|
||||
g_autoptr (MetaContext) context = NULL;
|
||||
|
||||
context = meta_create_test_context (META_CONTEXT_TEST_TYPE_NESTED);
|
||||
context = meta_create_test_context (META_CONTEXT_TEST_TYPE_NESTED,
|
||||
META_CONTEXT_TEST_FLAG_NO_X11);
|
||||
g_assert (meta_context_configure (context, &argc, &argv, NULL));
|
||||
|
||||
init_tests ();
|
||||
|
@ -1124,7 +1124,8 @@ main (int argc, char **argv)
|
||||
GPtrArray *tests;
|
||||
RunTestsInfo info;
|
||||
|
||||
context = meta_create_test_context (META_CONTEXT_TEST_TYPE_NESTED);
|
||||
context = meta_create_test_context (META_CONTEXT_TEST_TYPE_NESTED,
|
||||
META_CONTEXT_TEST_FLAG_TEST_CLIENT);
|
||||
|
||||
meta_context_add_option_entries (context, options, NULL);
|
||||
|
||||
|
@ -235,7 +235,8 @@ main (int argc, char *argv[])
|
||||
{
|
||||
g_autoptr (MetaContext) context = NULL;
|
||||
|
||||
context = meta_create_test_context (META_CONTEXT_TEST_TYPE_NESTED);
|
||||
context = meta_create_test_context (META_CONTEXT_TEST_TYPE_NESTED,
|
||||
META_CONTEXT_TEST_FLAG_TEST_CLIENT);
|
||||
g_assert (meta_context_configure (context, &argc, &argv, NULL));
|
||||
|
||||
init_tests ();
|
||||
|
Loading…
Reference in New Issue
Block a user