[mutter] tests/native-headless: Port to MetaContext



commit bccd93a5982fd19475c458a07d462b37af686026
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Tue Mar 2 15:31:01 2021 +0100

    tests/native-headless: Port to MetaContext
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>

 src/tests/native-headless.c | 46 ++++++---------------------------------------
 1 file changed, 6 insertions(+), 40 deletions(-)
---
diff --git a/src/tests/native-headless.c b/src/tests/native-headless.c
index a20cd1a673..47689b8631 100644
--- a/src/tests/native-headless.c
+++ b/src/tests/native-headless.c
@@ -20,16 +20,9 @@
 
 #include "config.h"
 
-#include "backends/meta-settings-private.h"
-#include "backends/native/meta-backend-native.h"
-#include "compositor/meta-plugin-manager.h"
-#include "core/main-private.h"
-#include "meta/main.h"
-#include "meta/meta-backend.h"
-#include "meta/meta-enums.h"
+#include "tests/meta-context-test.h"
 #include "tests/native-screen-cast.h"
 #include "tests/native-virtual-monitor.h"
-#include "tests/test-utils.h"
 
 static void
 init_tests (void)
@@ -38,43 +31,16 @@ init_tests (void)
   init_screen_cast_tests ();
 }
 
-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;
-}
-
 int
 main (int    argc,
       char **argv)
 {
-  test_init (&argc, &argv);
-  init_tests ();
-
-  meta_plugin_manager_load (test_get_plugin_name ());
+  g_autoptr (MetaContext) context = NULL;
 
-  meta_override_compositor_configuration (META_COMPOSITOR_TYPE_WAYLAND,
-                                          META_TYPE_BACKEND_NATIVE,
-                                          "headless", TRUE,
-                                          NULL);
+  context = meta_create_test_context (META_CONTEXT_TEST_TYPE_HEADLESS);
+  g_assert (meta_context_configure (context, &argc, &argv, NULL));
 
-  meta_init ();
-  meta_register_with_session ();
-
-  g_idle_add (run_tests, NULL);
+  init_tests ();
 
-  return meta_run ();
+  return meta_context_test_run_tests (META_CONTEXT_TEST (context));
 }


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