[mutter] context/test: Configure test setup during configuration



commit 8cb177499d771b4b32e87e158b5e67277f59550d
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Tue Mar 2 10:44:02 2021 +0100

    context/test: Configure test setup during configuration
    
    This includes setting up the GLib test framework, overriding the X11
    and Wayland display names.
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>

 src/tests/meson.build         | 14 ++------------
 src/tests/meta-context-test.c | 12 ++++++++++++
 2 files changed, 14 insertions(+), 12 deletions(-)
---
diff --git a/src/tests/meson.build b/src/tests/meson.build
index ac485a634a..bf9d63190f 100644
--- a/src/tests/meson.build
+++ b/src/tests/meson.build
@@ -45,6 +45,8 @@ test_env.set('MUTTER_TEST_PLUGIN_PATH', '@0@'.format(default_plugin.full_path())
 test_context_sources = [
   'meta-context-test.c',
   'meta-context-test.h',
+  'test-utils.c',
+  'test-utils.h',
 ]
 
 test_client = executable('mutter-test-client',
@@ -77,8 +79,6 @@ test_runner = executable('mutter-test-runner',
 unit_tests = executable('mutter-test-unit-tests',
   sources: [
     test_context_sources,
-    'test-utils.c',
-    'test-utils.h',
     'unit-tests.c',
     'boxes-tests.c',
     'boxes-tests.h',
@@ -122,8 +122,6 @@ headless_start_test = executable('mutter-headless-start-test',
     'meta-gpu-test.h',
     'meta-monitor-manager-test.c',
     'meta-monitor-manager-test.h',
-    'test-utils.c',
-    'test-utils.h',
   ],
   include_directories: tests_includepath,
   c_args: tests_c_args,
@@ -144,8 +142,6 @@ stage_view_tests = executable('mutter-stage-view-tests',
     'monitor-test-utils.c',
     'monitor-test-utils.h',
     'stage-view-tests.c',
-    'test-utils.c',
-    'test-utils.h',
   ],
   include_directories: tests_includepath,
   c_args: tests_c_args,
@@ -190,8 +186,6 @@ if have_native_tests
       'native-screen-cast.h',
       'native-virtual-monitor.c',
       'native-virtual-monitor.h',
-      'test-utils.c',
-      'test-utils.h',
       ref_test_sources,
     ],
     include_directories: tests_includepath,
@@ -205,8 +199,6 @@ if have_native_tests
     sources: [
       test_context_sources,
       'ref-test-sanity.c',
-      'test-utils.c',
-      'test-utils.h',
       ref_test_sources,
     ],
     include_directories: tests_includepath,
@@ -236,8 +228,6 @@ if have_native_tests
     sources: [
       test_context_sources,
       'native-persistent-virtual-monitor.c',
-      'test-utils.c',
-      'test-utils.h',
     ],
     include_directories: tests_includepath,
     c_args: tests_c_args,
diff --git a/src/tests/meta-context-test.c b/src/tests/meta-context-test.c
index 4adce2a7cb..e635049097 100644
--- a/src/tests/meta-context-test.c
+++ b/src/tests/meta-context-test.c
@@ -22,6 +22,10 @@
 
 #include "tests/meta-context-test.h"
 
+#include "tests/test-utils.h"
+#include "wayland/meta-wayland.h"
+#include "wayland/meta-xwayland.h"
+
 struct _MetaContextTest
 {
   GObject parent;
@@ -35,6 +39,14 @@ meta_context_test_configure (MetaContext   *context,
                              char        ***argv,
                              GError       **error)
 {
+  g_test_init (argc, argv, NULL);
+  g_test_bug_base ("https://gitlab.gnome.org/GNOME/mutter/issues/";);
+
+  meta_ensure_test_client_path (*argc, *argv);
+
+  meta_wayland_override_display_name ("mutter-test-display");
+  meta_xwayland_override_display_number (512);
+
   return TRUE;
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]