mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 09:30:45 -05:00
tests/unit-tests: Port to MetaContext
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>
This commit is contained in:
parent
ccd8da336f
commit
3d2160b473
@ -25,19 +25,15 @@
|
|||||||
#include <meta/main.h>
|
#include <meta/main.h>
|
||||||
#include <meta/util.h>
|
#include <meta/util.h>
|
||||||
|
|
||||||
#include "compositor/meta-plugin-manager.h"
|
|
||||||
#include "core/boxes-private.h"
|
#include "core/boxes-private.h"
|
||||||
#include "core/main-private.h"
|
#include "meta/meta-context.h"
|
||||||
#include "meta/meta-enums.h"
|
|
||||||
#include "tests/boxes-tests.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-config-migration-unit-tests.h"
|
||||||
#include "tests/monitor-unit-tests.h"
|
#include "tests/monitor-unit-tests.h"
|
||||||
#include "tests/monitor-store-unit-tests.h"
|
#include "tests/monitor-store-unit-tests.h"
|
||||||
#include "tests/monitor-transform-tests.h"
|
#include "tests/monitor-transform-tests.h"
|
||||||
#include "tests/test-utils.h"
|
|
||||||
#include "tests/wayland-unit-tests.h"
|
#include "tests/wayland-unit-tests.h"
|
||||||
#include "wayland/meta-wayland.h"
|
|
||||||
|
|
||||||
typedef struct _MetaTestLaterOrderCallbackData
|
typedef struct _MetaTestLaterOrderCallbackData
|
||||||
{
|
{
|
||||||
@ -217,33 +213,8 @@ meta_test_adjacent_to (void)
|
|||||||
g_assert (!meta_rectangle_is_adjacent_to (&base, ¬_adjacent[i]));
|
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
|
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/order", meta_test_util_later_order);
|
||||||
g_test_add_func ("/util/meta-later/schedule-from-later",
|
g_test_add_func ("/util/meta-later/schedule-from-later",
|
||||||
@ -262,19 +233,19 @@ init_tests (int argc, char **argv)
|
|||||||
int
|
int
|
||||||
main (int argc, char *argv[])
|
main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
test_init (&argc, &argv);
|
g_autoptr (MetaContext) context = NULL;
|
||||||
init_tests (argc, argv);
|
|
||||||
|
|
||||||
meta_plugin_manager_load (test_get_plugin_name ());
|
context = meta_create_test_context (META_CONTEXT_TEST_TYPE_NESTED);
|
||||||
|
g_assert (meta_context_configure (context, &argc, &argv, NULL));
|
||||||
|
|
||||||
meta_override_compositor_configuration (META_COMPOSITOR_TYPE_WAYLAND,
|
init_tests ();
|
||||||
META_TYPE_BACKEND_TEST,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
meta_init ();
|
g_signal_connect (context, "before-tests",
|
||||||
meta_register_with_session ();
|
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);
|
||||||
|
|
||||||
g_idle_add (run_tests, NULL);
|
return meta_context_test_run_tests (META_CONTEXT_TEST (context));
|
||||||
|
|
||||||
return meta_run ();
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user