From 8a8ab6c6736b2647e476093598000dc61d2766d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Wed, 7 Dec 2016 15:33:45 +0800 Subject: [PATCH] tests/monitor: Test preferred mode https://bugzilla.gnome.org/show_bug.cgi?id=777732 --- src/tests/monitor-unit-tests.c | 67 ++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/src/tests/monitor-unit-tests.c b/src/tests/monitor-unit-tests.c index 0c3499873..b2f85c68e 100644 --- a/src/tests/monitor-unit-tests.c +++ b/src/tests/monitor-unit-tests.c @@ -410,6 +410,71 @@ meta_test_monitor_one_off_linear_config (void) check_monitor_configuration (&test_case); } +static void +meta_test_monitor_preferred_linear_config (void) +{ + MonitorTestCase test_case = { + .setup = { + .modes = { + { + .width = 800, + .height = 600, + .refresh_rate = 60.0 + }, + { + .width = 1024, + .height = 768, + .refresh_rate = 60.0 + }, + { + .width = 1280, + .height = 720, + .refresh_rate = 60.0 + } + }, + .n_modes = 3, + .outputs = { + { + .crtc = -1, + .modes = { 0, 1, 2 }, + .n_modes = 3, + .preferred_mode = 1, + .possible_crtcs = { 0 }, + .n_possible_crtcs = 1, + .width_mm = 222, + .height_mm = 125 + } + }, + .n_outputs = 1, + .crtcs = { + { + .current_mode = -1 + } + }, + .n_crtcs = 1 + }, + + .expect = { + .logical_monitors = { + { + .layout = { .x = 0, .y = 0, .width = 1024, .height = 768 }, + .scale = 1 + }, + }, + .n_logical_monitors = 1, + .n_outputs = 1, + .n_crtcs = 1, + .screen_width = 1024, + .screen_height = 768, + } + }; + MetaMonitorTestSetup *test_setup; + + test_setup = create_monitor_test_setup (&test_case); + emulate_hotplug (test_setup); + check_monitor_configuration (&test_case); +} + void init_monitor_tests (void) { @@ -424,4 +489,6 @@ init_monitor_tests (void) meta_test_monitor_one_disconnected_linear_config); g_test_add_func ("/backends/monitor/one-off-linear-config", meta_test_monitor_one_off_linear_config); + g_test_add_func ("/backends/monitor/preferred-linear-config", + meta_test_monitor_preferred_linear_config); }