[mutter/gnome-42] tests/runner: Add 'resize_monitor' metatest command
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/gnome-42] tests/runner: Add 'resize_monitor' metatest command
- Date: Thu, 11 Aug 2022 12:45:57 +0000 (UTC)
commit 97c5638a35e8b5d0d01582994fb524a2998b3ce6
Author: Jonas Ådahl <jadahl gmail com>
Date: Wed Aug 3 18:57:10 2022 +0200
tests/runner: Add 'resize_monitor' metatest command
This will allow tests to change monitor resolution. The first argument
is the monitor ID; there is always one monitor added by default, and it
has the id 0. It's currently not possible to add more monitors, so
passing '0' is the only valid way to resize monitors.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2554>
src/backends/meta-virtual-monitor.h | 1 +
src/tests/test-runner.c | 23 +++++++++++++++++++++++
2 files changed, 24 insertions(+)
---
diff --git a/src/backends/meta-virtual-monitor.h b/src/backends/meta-virtual-monitor.h
index c127c46cad..6699c8ece9 100644
--- a/src/backends/meta-virtual-monitor.h
+++ b/src/backends/meta-virtual-monitor.h
@@ -70,6 +70,7 @@ void meta_virtual_monitor_info_free (MetaVirtualMonitorInfo *info);
MetaCrtc * meta_virtual_monitor_get_crtc (MetaVirtualMonitor *virtual_monitor);
+META_EXPORT_TEST
MetaCrtcMode * meta_virtual_monitor_get_crtc_mode (MetaVirtualMonitor *virtual_monitor);
META_EXPORT_TEST
diff --git a/src/tests/test-runner.c b/src/tests/test-runner.c
index c67780c9c1..75d9c765de 100644
--- a/src/tests/test-runner.c
+++ b/src/tests/test-runner.c
@@ -989,6 +989,29 @@ test_case_do (TestCase *test,
if (!meta_test_client_do (client, error, argv[0], argv[2], argv[3], NULL))
return FALSE;
}
+ else if (strcmp (argv[0], "resize_monitor") == 0)
+ {
+ MetaBackend *backend = meta_context_get_backend (test->context);
+ MetaMonitorManager *monitor_manager =
+ meta_backend_get_monitor_manager (backend);
+ MetaCrtcMode *crtc_mode;
+ const MetaCrtcModeInfo *crtc_mode_info;
+
+ if (argc != 4)
+ BAD_COMMAND ("usage: %s <monitor-id> <width> <height>", argv[0]);
+
+ if (strcmp (argv[1], "0") != 0 &&
+ strcmp (argv[1], "primary") != 0)
+ BAD_COMMAND ("Unknown monitor %s", argv[1]);
+
+ crtc_mode = meta_virtual_monitor_get_crtc_mode (test->virtual_monitor);
+ crtc_mode_info = meta_crtc_mode_get_info (crtc_mode);
+ meta_virtual_monitor_set_mode (test->virtual_monitor,
+ atoi (argv[2]),
+ atoi (argv[3]),
+ crtc_mode_info->refresh_rate);
+ meta_monitor_manager_reload (monitor_manager);
+ }
else
{
BAD_COMMAND("Unknown command %s", argv[0]);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]