tests/headless-start: Port to MetaContext

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>
This commit is contained in:
Jonas Ådahl 2021-03-02 19:51:54 +01:00
parent fbc00a60cf
commit f8465906dd

View File

@ -22,35 +22,9 @@
#include "backends/meta-monitor-manager-private.h" #include "backends/meta-monitor-manager-private.h"
#include "backends/meta-crtc.h" #include "backends/meta-crtc.h"
#include "backends/meta-output.h" #include "backends/meta-output.h"
#include "compositor/meta-plugin-manager.h"
#include "core/display-private.h" #include "core/display-private.h"
#include "core/main-private.h" #include "tests/meta-context-test.h"
#include "meta/main.h"
#include "meta/meta-enums.h"
#include "tests/meta-backend-test.h"
#include "tests/meta-monitor-manager-test.h" #include "tests/meta-monitor-manager-test.h"
#include "tests/test-utils.h"
#include "wayland/meta-wayland.h"
static gboolean
run_tests (gpointer data)
{
MetaBackend *backend = meta_get_backend ();
MetaSettings *settings = meta_backend_get_settings (backend);
gboolean ret;
meta_settings_override_experimental_features (settings);
meta_settings_enable_experimental_feature (
settings,
META_EXPERIMENTAL_FEATURE_SCALE_MONITOR_FRAMEBUFFER);
ret = g_test_run ();
meta_quit (ret != 0);
return FALSE;
}
static void static void
meta_test_headless_start (void) meta_test_headless_start (void)
@ -180,7 +154,7 @@ create_headless_test_setup (void)
} }
static void static void
init_tests (int argc, char **argv) init_tests (void)
{ {
meta_monitor_manager_test_init_test_setup (create_headless_test_setup); meta_monitor_manager_test_init_test_setup (create_headless_test_setup);
@ -194,19 +168,12 @@ init_tests (int argc, char **argv)
int int
main (int argc, char *argv[]) main (int argc, char *argv[])
{ {
test_init (&argc, &argv); g_autoptr (MetaContext) context = NULL;
init_tests (argc, argv);
meta_plugin_manager_load (test_get_plugin_name ()); context = meta_create_test_context (META_CONTEXT_TEST_TYPE_NESTED);
g_assert (meta_context_configure (context, &argc, &argv, NULL));
meta_override_compositor_configuration (META_COMPOSITOR_TYPE_WAYLAND, init_tests ();
META_TYPE_BACKEND_TEST,
NULL);
meta_init (); return meta_context_test_run_tests (META_CONTEXT_TEST (context));
meta_register_with_session ();
g_idle_add (run_tests, NULL);
return meta_run ();
} }