[mutter] tests/unit-tests: Port to MetaContext
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] tests/unit-tests: Port to MetaContext
- Date: Thu, 15 Jul 2021 12:40:53 +0000 (UTC)
commit 3d2160b4736d6e4ef2be31b37f5e099f0a69fb41
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Tue Mar 2 16:38:33 2021 +0100
tests/unit-tests: Port to MetaContext
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>
src/tests/unit-tests.c | 57 +++++++++++++-------------------------------------
1 file changed, 14 insertions(+), 43 deletions(-)
---
diff --git a/src/tests/unit-tests.c b/src/tests/unit-tests.c
index 88e3a5b8a6..c7c9943e69 100644
--- a/src/tests/unit-tests.c
+++ b/src/tests/unit-tests.c
@@ -25,19 +25,15 @@
#include <meta/main.h>
#include <meta/util.h>
-#include "compositor/meta-plugin-manager.h"
#include "core/boxes-private.h"
-#include "core/main-private.h"
-#include "meta/meta-enums.h"
+#include "meta/meta-context.h"
#include "tests/boxes-tests.h"
-#include "tests/meta-backend-test.h"
+#include "tests/meta-context-test.h"
#include "tests/monitor-config-migration-unit-tests.h"
#include "tests/monitor-unit-tests.h"
#include "tests/monitor-store-unit-tests.h"
#include "tests/monitor-transform-tests.h"
-#include "tests/test-utils.h"
#include "tests/wayland-unit-tests.h"
-#include "wayland/meta-wayland.h"
typedef struct _MetaTestLaterOrderCallbackData
{
@@ -217,33 +213,8 @@ meta_test_adjacent_to (void)
g_assert (!meta_rectangle_is_adjacent_to (&base, ¬_adjacent[i]));
}
-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);
-
- pre_run_monitor_tests ();
- pre_run_wayland_tests ();
-
- ret = g_test_run ();
-
- finish_monitor_tests ();
-
- meta_quit (ret != 0);
-
- return FALSE;
-}
-
static void
-init_tests (int argc, char **argv)
+init_tests (void)
{
g_test_add_func ("/util/meta-later/order", meta_test_util_later_order);
g_test_add_func ("/util/meta-later/schedule-from-later",
@@ -262,19 +233,19 @@ 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 ());
+ g_autoptr (MetaContext) context = NULL;
- meta_override_compositor_configuration (META_COMPOSITOR_TYPE_WAYLAND,
- META_TYPE_BACKEND_TEST,
- NULL);
+ context = meta_create_test_context (META_CONTEXT_TEST_TYPE_NESTED);
+ g_assert (meta_context_configure (context, &argc, &argv, NULL));
- meta_init ();
- meta_register_with_session ();
+ init_tests ();
- g_idle_add (run_tests, NULL);
+ g_signal_connect (context, "before-tests",
+ G_CALLBACK (pre_run_monitor_tests), NULL);
+ g_signal_connect (context, "before-tests",
+ G_CALLBACK (pre_run_wayland_tests), NULL);
+ g_signal_connect (context, "after-tests",
+ G_CALLBACK (finish_monitor_tests), NULL);
- 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]