[mutter] tests/stage-view-tests: Port to MetaContext



commit 383392f963fbe90923cb75fd2084db2978b522d3
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Tue Mar 2 19:59:35 2021 +0100

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

 src/tests/stage-view-tests.c | 49 +++++++-------------------------------------
 1 file changed, 7 insertions(+), 42 deletions(-)
---
diff --git a/src/tests/stage-view-tests.c b/src/tests/stage-view-tests.c
index 007d621d26..4e839e76e1 100644
--- a/src/tests/stage-view-tests.c
+++ b/src/tests/stage-view-tests.c
@@ -19,37 +19,9 @@
 
 #include "clutter/clutter.h"
 #include "clutter/clutter-stage-view-private.h"
-#include "compositor/meta-plugin-manager.h"
-#include "core/main-private.h"
-#include "meta/main.h"
-#include "meta/meta-enums.h"
 #include "tests/meta-backend-test.h"
+#include "tests/meta-context-test.h"
 #include "tests/monitor-test-utils.h"
-#include "tests/test-utils.h"
-
-#define FRAME_WARNING "Frame has assigned frame counter but no frame drawn time"
-
-static gboolean
-run_tests (gpointer data)
-{
-  MetaBackend *backend = meta_get_backend ();
-  MetaSettings *settings = meta_backend_get_settings (backend);
-  gboolean ret;
-
-  g_test_log_set_fatal_handler (NULL, NULL);
-
-  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 G_SOURCE_REMOVE;
-}
 
 static MonitorTestCaseSetup initial_test_case_setup = {
   .modes = {
@@ -1154,7 +1126,7 @@ meta_test_timeline_actor_destroyed (void)
 }
 
 static void
-init_tests (int argc, char **argv)
+init_tests (void)
 {
   meta_monitor_manager_test_init_test_setup (create_stage_view_test_setup);
 
@@ -1187,19 +1159,12 @@ init_tests (int argc, char **argv)
 int
 main (int argc, char *argv[])
 {
-  test_init (&argc, &argv);
-  init_tests (argc, argv);
-
-  meta_plugin_manager_load (test_get_plugin_name ());
-
-  meta_override_compositor_configuration (META_COMPOSITOR_TYPE_WAYLAND,
-                                          META_TYPE_BACKEND_TEST,
-                                          NULL);
+  g_autoptr (MetaContext) context = NULL;
 
-  meta_init ();
-  meta_register_with_session ();
+  context = meta_create_test_context (META_CONTEXT_TEST_TYPE_NESTED);
+  g_assert (meta_context_configure (context, &argc, &argv, NULL));
 
-  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]