From 6776329cf5cb35bb3523fdfcd5241ea6d7bcbe93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Wed, 7 Dec 2016 15:15:25 +0800 Subject: [PATCH] tests/monitor: Test two crtcs, one output https://bugzilla.gnome.org/show_bug.cgi?id=777732 --- src/tests/monitor-unit-tests.c | 41 ++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/src/tests/monitor-unit-tests.c b/src/tests/monitor-unit-tests.c index 9a14f3c06..b344f04b9 100644 --- a/src/tests/monitor-unit-tests.c +++ b/src/tests/monitor-unit-tests.c @@ -313,6 +313,45 @@ meta_test_monitor_initial_linear_config (void) check_monitor_configuration (&initial_test_case); } +static void +emulate_hotplug (MetaMonitorTestSetup *test_setup) +{ + MetaBackend *backend = meta_get_backend (); + MetaMonitorManager *monitor_manager = + meta_backend_get_monitor_manager (backend); + MetaMonitorManagerTest *monitor_manager_test = + META_MONITOR_MANAGER_TEST (monitor_manager); + + meta_monitor_manager_test_emulate_hotplug (monitor_manager_test, test_setup); +} + +static void +meta_test_monitor_one_disconnected_linear_config (void) +{ + MonitorTestCase test_case = initial_test_case; + MetaMonitorTestSetup *test_setup; + + test_case.setup.n_outputs = 1; + + test_case.expect = (MonitorTestCaseExpect) { + .logical_monitors = { + { + .layout = { .x = 0, .y = 0, .width = 1024, .height = 768 }, + .scale = 1 + }, + }, + .n_logical_monitors = 1, + .n_outputs = 1, + .n_crtcs = 2, + .screen_width = 1024, + .screen_height = 768 + }; + + test_setup = create_monitor_test_setup (&test_case); + emulate_hotplug (test_setup); + check_monitor_configuration (&test_case); +} + void init_monitor_tests (void) { @@ -323,4 +362,6 @@ init_monitor_tests (void) g_test_add_func ("/backends/monitor/initial-linear-config", meta_test_monitor_initial_linear_config); + g_test_add_func ("/backends/monitor/one-disconnected-linear-config", + meta_test_monitor_one_disconnected_linear_config); }