From 532c63e96c70f2651d9da0696b94dbb48a36cc50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Wed, 3 Aug 2022 18:02:37 +0200 Subject: [PATCH] tests/runner: Make test runner use the headless backend Using the headless backend means we can use virtual monitors, which means we can unblock add support for hotplugging via metatests. Part-of: --- src/tests/test-runner.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/tests/test-runner.c b/src/tests/test-runner.c index 84992a23e..efd9bc1a8 100644 --- a/src/tests/test-runner.c +++ b/src/tests/test-runner.c @@ -24,6 +24,7 @@ #include #include +#include "backends/meta-virtual-monitor.h" #include "core/window-private.h" #include "meta-test/meta-context-test.h" #include "meta/util.h" @@ -115,6 +116,9 @@ static gboolean test_case_dispatch (TestCase *test, GError **error) { + MetaBackend *backend = meta_context_get_backend (test->context); + ClutterActor *stage = meta_backend_get_stage (backend); + /* Wait until we've done any outstanding queued up work. * Though we add this as BEFORE_REDRAW, the iteration that runs the * BEFORE_REDRAW idles will proceed on and do the redraw, so we're @@ -124,6 +128,8 @@ test_case_dispatch (TestCase *test, test_case_loop_quit, test, NULL); + + clutter_stage_schedule_update (CLUTTER_STAGE (stage)); g_main_loop_run (test->loop); return TRUE; @@ -1152,6 +1158,9 @@ run_tests (MetaContext *context, { int i; gboolean success = TRUE; + MetaVirtualMonitor *virtual_monitor; + + virtual_monitor = meta_create_test_monitor (context, 800, 600, 60.0); g_print ("1..%d\n", info->n_tests); @@ -1161,6 +1170,8 @@ run_tests (MetaContext *context, success = FALSE; } + g_object_unref (virtual_monitor); + return success ? 0 : 1; } @@ -1239,7 +1250,7 @@ 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_HEADLESS, META_CONTEXT_TEST_FLAG_TEST_CLIENT); meta_context_add_option_entries (context, options, NULL);