[mutter] tests/monitor: Test one out of two outputs being off



commit 9e28303588b07f8426eba17196de58115c62321b
Author: Jonas Ådahl <jadahl gmail com>
Date:   Wed Dec 7 15:16:12 2016 +0800

    tests/monitor: Test one out of two outputs being off
    
    https://bugzilla.gnome.org/show_bug.cgi?id=777732

 src/tests/monitor-unit-tests.c |   60 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 60 insertions(+), 0 deletions(-)
---
diff --git a/src/tests/monitor-unit-tests.c b/src/tests/monitor-unit-tests.c
index b344f04..0c34998 100644
--- a/src/tests/monitor-unit-tests.c
+++ b/src/tests/monitor-unit-tests.c
@@ -352,6 +352,64 @@ meta_test_monitor_one_disconnected_linear_config (void)
   check_monitor_configuration (&test_case);
 }
 
+static void
+meta_test_monitor_one_off_linear_config (void)
+{
+  MonitorTestCase test_case;
+  MetaMonitorTestSetup *test_setup;
+  MonitorTestCaseOutput outputs[] = {
+    {
+      .crtc = 0,
+      .modes = { 0 },
+      .n_modes = 1,
+      .preferred_mode = 0,
+      .possible_crtcs = { 0 },
+      .n_possible_crtcs = 1,
+      .width_mm = 222,
+      .height_mm = 125
+    },
+    {
+      .crtc = -1,
+      .modes = { 0 },
+      .n_modes = 1,
+      .preferred_mode = 0,
+      .possible_crtcs = { 1 },
+      .n_possible_crtcs = 1,
+      .width_mm = 222,
+      .height_mm = 125
+    }
+  };
+
+  test_case = initial_test_case;
+
+  memcpy (&test_case.setup.outputs, &outputs, sizeof (outputs));
+  test_case.setup.n_outputs = G_N_ELEMENTS (outputs);
+
+  test_case.setup.crtcs[1].current_mode = -1;
+
+  test_case.expect = (MonitorTestCaseExpect) {
+    .logical_monitors = {
+      {
+        .layout = { .x = 0, .y = 0, .width = 1024, .height = 768 },
+        .scale = 1
+      },
+      {
+        .layout = { .x = 1024, .y = 0, .width = 1024, .height = 768 },
+        .scale = 1
+      },
+    },
+    .n_logical_monitors = 2,
+    .n_outputs = 2,
+    .n_crtcs = 2,
+    .screen_width = 1024 * 2,
+    .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)
 {
@@ -364,4 +422,6 @@ init_monitor_tests (void)
                    meta_test_monitor_initial_linear_config);
   g_test_add_func ("/backends/monitor/one-disconnected-linear-config",
                    meta_test_monitor_one_disconnected_linear_config);
+  g_test_add_func ("/backends/monitor/one-off-linear-config",
+                   meta_test_monitor_one_off_linear_config);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]