[mutter] monitor-store-unit-tests: Add test for vertical placement



commit 702facbc9111ede0c551a2ffa17eace7689b69ef
Author: Jonas Ådahl <jadahl gmail com>
Date:   Thu Jan 12 16:36:45 2017 +0800

    monitor-store-unit-tests: Add test for vertical placement
    
    https://bugzilla.gnome.org/show_bug.cgi?id=777732

 src/tests/monitor-configs/vertical.xml |   39 +++++++++++++++++
 src/tests/monitor-store-unit-tests.c   |   73 ++++++++++++++++++++++++++++++++
 2 files changed, 112 insertions(+), 0 deletions(-)
---
diff --git a/src/tests/monitor-configs/vertical.xml b/src/tests/monitor-configs/vertical.xml
new file mode 100644
index 0000000..76f1129
--- /dev/null
+++ b/src/tests/monitor-configs/vertical.xml
@@ -0,0 +1,39 @@
+<monitors version="2">
+  <configuration>
+    <logicalmonitor>
+      <x>0</x>
+      <y>0</y>
+      <primary>yes</primary>
+      <monitor>
+       <monitorspec>
+         <connector>DP-1</connector>
+         <vendor>MetaProduct's Inc.</vendor>
+         <product>MetaMonitor</product>
+         <serial>0x123456</serial>
+       </monitorspec>
+       <mode>
+         <width>1024</width>
+         <height>768</height>
+         <rate>60.000495910644531</rate>
+       </mode>
+      </monitor>
+    </logicalmonitor>
+    <logicalmonitor>
+      <x>0</x>
+      <y>768</y>
+      <monitor>
+       <monitorspec>
+         <connector>DP-2</connector>
+         <vendor>MetaProduct's Inc.</vendor>
+         <product>MetaMonitor</product>
+         <serial>0x123456</serial>
+       </monitorspec>
+       <mode>
+         <width>800</width>
+         <height>600</height>
+         <rate>60.000495910644531</rate>
+       </mode>
+      </monitor>
+    </logicalmonitor>
+  </configuration>
+</monitors>
diff --git a/src/tests/monitor-store-unit-tests.c b/src/tests/monitor-store-unit-tests.c
index 5b2e8cf..3d6a647 100644
--- a/src/tests/monitor-store-unit-tests.c
+++ b/src/tests/monitor-store-unit-tests.c
@@ -271,9 +271,82 @@ meta_test_monitor_store_single (void)
   check_monitor_configurations (config_store, &expect);
 }
 
+static void
+meta_test_monitor_store_vertical (void)
+{
+  MetaMonitorConfigStore *config_store;
+  MonitorStoreTestExpect expect = {
+    .configurations = {
+      {
+        .logical_monitors = {
+          {
+            .layout = {
+              .x = 0,
+              .y = 0,
+              .width = 1024,
+              .height = 768
+            },
+            .monitors = {
+              {
+                .connector = "DP-1",
+                .vendor = "MetaProduct's Inc.",
+                .product = "MetaMonitor",
+                .serial = "0x123456",
+                .mode = {
+                  .width = 1024,
+                  .height = 768,
+                  .refresh_rate = 60.000495910644531
+                }
+              }
+            },
+            .n_monitors = 1,
+          },
+          {
+            .layout = {
+              .x = 0,
+              .y = 768,
+              .width = 800,
+              .height = 600
+            },
+            .monitors = {
+              {
+                .connector = "DP-2",
+                .vendor = "MetaProduct's Inc.",
+                .product = "MetaMonitor",
+                .serial = "0x123456",
+                .mode = {
+                  .width = 800,
+                  .height = 600,
+                  .refresh_rate = 60.000495910644531
+                }
+              }
+            },
+            .n_monitors = 1,
+          }
+        },
+        .n_logical_monitors = 2
+      }
+    },
+    .n_configurations = 1
+  };
+
+  config_store = get_monitor_config_store ();
+  if (!config_store)
+    {
+      g_test_skip ("Not using MetaMonitorConfigManager");
+      return;
+    }
+
+  set_custom_test_file (config_store, "vertical.xml");
+
+  check_monitor_configurations (config_store, &expect);
+}
+
 void
 init_monitor_store_tests (void)
 {
   g_test_add_func ("/backends/monitor-store/single",
                    meta_test_monitor_store_single);
+  g_test_add_func ("/backends/monitor-store/vertical",
+                   meta_test_monitor_store_vertical);
 }


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