[mutter] monitor-manager/test: Add default fall back initial config



commit 54c9ca7d06e61f9fade6719a24fb5b8a26022918
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Tue Mar 2 18:52:52 2021 +0100

    monitor-manager/test: Add default fall back initial config
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>

 src/tests/meta-monitor-manager-test.c | 44 ++++++++++++++++++++++++++++++++++-
 1 file changed, 43 insertions(+), 1 deletion(-)
---
diff --git a/src/tests/meta-monitor-manager-test.c b/src/tests/meta-monitor-manager-test.c
index 5a672c58f9..e3b4f46cf5 100644
--- a/src/tests/meta-monitor-manager-test.c
+++ b/src/tests/meta-monitor-manager-test.c
@@ -27,6 +27,7 @@
 #include "backends/meta-monitor-config-manager.h"
 #include "backends/meta-output.h"
 #include "tests/meta-backend-test.h"
+#include "tests/monitor-test-utils.h"
 
 G_DEFINE_TYPE (MetaCrtcTest, meta_crtc_test, META_TYPE_CRTC)
 G_DEFINE_TYPE (MetaOutputTest, meta_output_test, META_TYPE_OUTPUT)
@@ -389,12 +390,53 @@ meta_monitor_manager_test_dispose (GObject *object)
   G_OBJECT_CLASS (meta_monitor_manager_test_parent_class)->dispose (object);
 }
 
+static MonitorTestCaseSetup default_test_case_setup = {
+  .modes = {
+    {
+      .width = 800,
+      .height = 600,
+      .refresh_rate = 60.0
+    }
+  },
+  .n_modes = 1,
+  .outputs = {
+     {
+      .crtc = 0,
+      .modes = { 0 },
+      .n_modes = 1,
+      .preferred_mode = 0,
+      .possible_crtcs = { 0 },
+      .n_possible_crtcs = 1,
+      .width_mm = 222,
+      .height_mm = 125
+    },
+
+  },
+  .n_outputs = 1,
+  .crtcs = {
+    {
+      .current_mode = 0
+    },
+  },
+  .n_crtcs = 1,
+};
+
+static MetaMonitorTestSetup *
+create_default_test_setup (void)
+{
+  return create_monitor_test_setup (&default_test_case_setup,
+                                    MONITOR_TEST_FLAG_NO_STORED);
+}
+
 static void
 meta_monitor_manager_test_constructed (GObject *object)
 {
   MetaMonitorManagerTest *manager_test = META_MONITOR_MANAGER_TEST (object);
 
-  manager_test->test_setup = initial_setup_func ();
+  if (initial_setup_func)
+    manager_test->test_setup = initial_setup_func ();
+  else
+    manager_test->test_setup = create_default_test_setup ();
 
   G_OBJECT_CLASS (meta_monitor_manager_test_parent_class)->constructed (object);
 }


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