context/test: Add test context type enum

A test context type will later determine what kind of backend the test
case should use; i.e. whether the nested or headless backend should be
used.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>
This commit is contained in:
Jonas Ådahl 2021-03-02 10:46:43 +01:00
parent 8cb177499d
commit 434f5e5b7b
2 changed files with 13 additions and 2 deletions

View File

@ -29,6 +29,8 @@
struct _MetaContextTest
{
GObject parent;
MetaContextTestType type;
};
G_DEFINE_TYPE (MetaContextTest, meta_context_test, META_TYPE_CONTEXT)
@ -57,13 +59,14 @@ meta_context_test_get_compositor_type (MetaContext *context)
}
MetaContext *
meta_create_test_context (void)
meta_create_test_context (MetaContextTestType type)
{
MetaContextTest *context_test;
context_test = g_object_new (META_TYPE_CONTEXT_TEST,
"name", "Mutter Test",
NULL);
context_test->type = type;
return META_CONTEXT (context_test);
}

View File

@ -23,11 +23,19 @@
#include "core/meta-context-private.h"
typedef enum _MetaContextTestType
{
#ifdef HAVE_NATIVE_BACKEND
META_CONTEXT_TEST_TYPE_HEADLESS,
#endif
META_CONTEXT_TEST_TYPE_NESTED,
} MetaContextTestType;
#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 (void);
MetaContext * meta_create_test_context (MetaContextTestType type);
#endif /* META_CONTEXT_TEST_H */