[mutter/gnome-42] tests/runner: Make test runner use the headless backend
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/gnome-42] tests/runner: Make test runner use the headless backend
- Date: Thu, 11 Aug 2022 12:45:57 +0000 (UTC)
commit 1bf7033458971ce1433ddcb02bbde8c69e14e51a
Author: Jonas Ådahl <jadahl gmail com>
Date: Wed Aug 3 18:02:37 2022 +0200
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: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2554>
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 84992a23e6..efd9bc1a82 100644
--- a/src/tests/test-runner.c
+++ b/src/tests/test-runner.c
@@ -24,6 +24,7 @@
#include <stdlib.h>
#include <string.h>
+#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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]