[mutter/gnome-42] tests/runner: Recreate the virtual monitor for each test
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/gnome-42] tests/runner: Recreate the virtual monitor for each test
- Date: Thu, 11 Aug 2022 12:45:57 +0000 (UTC)
commit 1ac64f6cf2833c64f927124d7cf951a5bee08142
Author: Jonas Ådahl <jadahl gmail com>
Date: Wed Aug 3 18:31:44 2022 +0200
tests/runner: Recreate the virtual monitor for each test
This ensures that the virtual monitor has an expected initial state each
test.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2554>
src/tests/test-runner.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
---
diff --git a/src/tests/test-runner.c b/src/tests/test-runner.c
index efd9bc1a82..c67780c9c1 100644
--- a/src/tests/test-runner.c
+++ b/src/tests/test-runner.c
@@ -42,6 +42,7 @@ typedef struct {
GString *warning_messages;
GMainLoop *loop;
gulong x11_display_opened_handler_id;
+ MetaVirtualMonitor *virtual_monitor;
} TestCase;
static gboolean
@@ -98,6 +99,7 @@ test_case_new (MetaContext *context)
test->context = context;
test->clients = g_hash_table_new (g_str_hash, g_str_equal);
test->loop = g_main_loop_new (NULL, FALSE);
+ test->virtual_monitor = meta_create_test_monitor (context, 800, 600, 60.0);
return test;
}
@@ -1033,6 +1035,7 @@ test_case_destroy (TestCase *test,
meta_x11_display_set_alarm_filter (display->x11_display, NULL, NULL);
g_hash_table_destroy (test->clients);
+ g_object_unref (test->virtual_monitor);
g_free (test);
return TRUE;
@@ -1158,9 +1161,6 @@ 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);
@@ -1170,7 +1170,6 @@ run_tests (MetaContext *context,
success = FALSE;
}
- g_object_unref (virtual_monitor);
return success ? 0 : 1;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]