[mutter] monitor-unit-tests: Check monitor mode CRTC mode positions



commit 3ae9feef0cce45fb210f8a57b76a1801c391119c
Author: Jonas Ådahl <jadahl gmail com>
Date:   Wed Jan 18 17:35:01 2017 +0800

    monitor-unit-tests: Check monitor mode CRTC mode positions
    
    Check that the crtc mode has the correct intra-monitor position. In
    effect, this tests that the CRTCs in a tiled monitor are configured with
    the correct mode on the correct position.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=777732

 src/tests/monitor-unit-tests.c |   46 +++++++++++++++++++++++++++++++++++++++-
 1 files changed, 45 insertions(+), 1 deletions(-)
---
diff --git a/src/tests/monitor-unit-tests.c b/src/tests/monitor-unit-tests.c
index e666956..10148d0 100644
--- a/src/tests/monitor-unit-tests.c
+++ b/src/tests/monitor-unit-tests.c
@@ -128,6 +128,8 @@ typedef struct _MonitorTestCaseMonitorCrtcMode
 {
   int output;
   int crtc_mode;
+  int x;
+  int y;
 } MetaTestCaseMonitorCrtcMode;
 
 typedef struct _MonitorTestCaseMonitorMode
@@ -324,6 +326,31 @@ check_monitor_mode (MetaMonitor         *monitor,
   g_assert (monitor_crtc_mode->output == output);
   g_assert (monitor_crtc_mode->crtc_mode == crtc_mode);
 
+  g_assert_cmpint (monitor_crtc_mode->x, ==, data->expect_crtc_mode_iter->x);
+  g_assert_cmpint (monitor_crtc_mode->y, ==, data->expect_crtc_mode_iter->y);
+
+  data->expect_crtc_mode_iter++;
+
+  return TRUE;
+}
+
+static gboolean
+check_current_monitor_mode (MetaMonitor         *monitor,
+                            MetaMonitorMode     *mode,
+                            MetaMonitorCrtcMode *monitor_crtc_mode,
+                            gpointer             user_data,
+                            GError             **error)
+{
+  CheckMonitorModeData *data = user_data;
+  MetaMonitorManager *monitor_manager = data->monitor_manager;
+  MetaOutput *output;
+
+  output = output_from_winsys_id (monitor_manager,
+                                  data->expect_crtc_mode_iter->output);
+
+  g_assert_nonnull (output->crtc);
+  g_assert (monitor_crtc_mode->crtc_mode == output->crtc->current_mode);
+
   data->expect_crtc_mode_iter++;
 
   return TRUE;
@@ -444,6 +471,21 @@ check_monitor_configuration (MonitorTestCase *test_case)
 
       g_assert (current_mode == expected_current_mode);
 
+      if (current_mode)
+        {
+          CheckMonitorModeData data;
+
+          data = (CheckMonitorModeData) {
+            .monitor_manager = monitor_manager,
+            .expect_crtc_mode_iter =
+              test_case->expect.monitors[i].modes[expected_current_mode_index].crtc_modes
+          };
+          meta_monitor_mode_foreach_crtc (monitor, expected_current_mode,
+                                          check_current_monitor_mode,
+                                          &data,
+                                          NULL);
+        }
+
       meta_monitor_derive_current_mode (monitor);
       g_assert (current_mode == meta_monitor_get_current_mode (monitor));
     }
@@ -1038,7 +1080,9 @@ meta_test_monitor_tiled_linear_config (void)
                 },
                 {
                   .output = 1,
-                  .crtc_mode = 0
+                  .crtc_mode = 0,
+                  .x = 400,
+                  .y = 0
                 }
               }
             },


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