[mutter] monitor-unit-tests: Add test for lid toggle after hot unplug
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] monitor-unit-tests: Add test for lid toggle after hot unplug
- Date: Thu, 30 Nov 2017 03:56:48 +0000 (UTC)
commit 050267fe74a162aca2eb52e82b6f237af8b13214
Author: Jonas Ådahl <jadahl gmail com>
Date: Thu Nov 9 13:33:38 2017 +0800
monitor-unit-tests: Add test for lid toggle after hot unplug
https://bugzilla.gnome.org/show_bug.cgi?id=788915
src/tests/monitor-unit-tests.c | 64 ++++++++++++++++++++++++++++++++++++++++
1 files changed, 64 insertions(+), 0 deletions(-)
---
diff --git a/src/tests/monitor-unit-tests.c b/src/tests/monitor-unit-tests.c
index 7a5954e..0617828 100644
--- a/src/tests/monitor-unit-tests.c
+++ b/src/tests/monitor-unit-tests.c
@@ -2768,6 +2768,13 @@ meta_test_monitor_lid_closed_with_hotplugged_external (void)
MetaMonitorManagerTest *monitor_manager_test =
META_MONITOR_MANAGER_TEST (monitor_manager);
+ /*
+ * The first part of this test emulate the following:
+ * 1) Start with the lid open
+ * 2) Connect external monitor
+ * 3) Close lid
+ */
+
test_setup = create_monitor_test_setup (&test_case,
MONITOR_TEST_FLAG_NO_STORED);
meta_monitor_manager_test_set_is_lid_closed (monitor_manager_test, FALSE);
@@ -2802,6 +2809,63 @@ meta_test_monitor_lid_closed_with_hotplugged_external (void)
meta_monitor_manager_test_set_is_lid_closed (monitor_manager_test, TRUE);
emulate_hotplug (test_setup);
check_monitor_configuration (&test_case);
+
+ /*
+ * The second part of this test emulate the following:
+ * 1) Open lid
+ * 2) Disconnect external monitor
+ * 3) Close lid
+ * 4) Open lid
+ */
+
+ /* Lid opened */
+
+ test_case.expect.monitors[0].current_mode = 0;
+ test_case.expect.logical_monitors[0].monitors[0] = 0,
+ test_case.expect.logical_monitors[1].monitors[0] = 1,
+ test_case.expect.n_logical_monitors = 2;
+ test_case.expect.crtcs[0].current_mode = 0;
+ test_case.expect.screen_width = 1024 * 2;
+
+ test_setup = create_monitor_test_setup (&test_case,
+ MONITOR_TEST_FLAG_NO_STORED);
+ meta_monitor_manager_test_set_is_lid_closed (monitor_manager_test, FALSE);
+ emulate_hotplug (test_setup);
+ check_monitor_configuration (&test_case);
+
+ /* External monitor disconnected */
+
+ test_case.setup.n_outputs = 1;
+ test_case.expect.n_outputs = 1;
+ test_case.expect.n_monitors = 1;
+ test_case.expect.n_logical_monitors = 1;
+ test_case.expect.crtcs[1].current_mode = -1;
+ test_case.expect.screen_width = 1024;
+
+ test_setup = create_monitor_test_setup (&test_case,
+ MONITOR_TEST_FLAG_NO_STORED);
+ emulate_hotplug (test_setup);
+ check_monitor_configuration (&test_case);
+
+ /* Lid closed */
+
+ test_case.expect.logical_monitors[0].monitors[0] = 0,
+ test_case.expect.n_logical_monitors = 1;
+ test_case.expect.screen_width = 1024;
+
+ test_setup = create_monitor_test_setup (&test_case,
+ MONITOR_TEST_FLAG_NO_STORED);
+ meta_monitor_manager_test_set_is_lid_closed (monitor_manager_test, TRUE);
+ emulate_hotplug (test_setup);
+ check_monitor_configuration (&test_case);
+
+ /* Lid opened */
+
+ test_setup = create_monitor_test_setup (&test_case,
+ MONITOR_TEST_FLAG_NO_STORED);
+ meta_monitor_manager_test_set_is_lid_closed (monitor_manager_test, FALSE);
+ emulate_hotplug (test_setup);
+ check_monitor_configuration (&test_case);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]