[mutter] monitor-unit-tests: Test configs with explicitly disabled monitors
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] monitor-unit-tests: Test configs with explicitly disabled monitors
- Date: Mon, 2 Oct 2017 20:14:01 +0000 (UTC)
commit 99e1cd549d02dbe74d521719d1c6a844f3d3d510
Author: Jonas Ådahl <jadahl gmail com>
Date: Thu Sep 28 11:57:50 2017 -0400
monitor-unit-tests: Test configs with explicitly disabled monitors
Check that configurations where monitors are disabled are properly
used. Also test that old configurations with explicitly disabled
outputs are migrated properly.
https://bugzilla.gnome.org/show_bug.cgi?id=787629
src/tests/migration/oneoff-new-finished.xml | 31 ++++++
src/tests/migration/oneoff-new.xml | 31 ++++++
src/tests/migration/oneoff-old.xml | 26 +++++
src/tests/monitor-config-migration-unit-tests.c | 8 ++
src/tests/monitor-configs/oneoff.xml | 31 ++++++
src/tests/monitor-unit-tests.c | 131 +++++++++++++++++++++++
6 files changed, 258 insertions(+), 0 deletions(-)
---
diff --git a/src/tests/migration/oneoff-new-finished.xml b/src/tests/migration/oneoff-new-finished.xml
new file mode 100644
index 0000000..d3ee95c
--- /dev/null
+++ b/src/tests/migration/oneoff-new-finished.xml
@@ -0,0 +1,31 @@
+<monitors version="2">
+ <configuration>
+ <logicalmonitor>
+ <x>0</x>
+ <y>0</y>
+ <scale>1</scale>
+ <primary>yes</primary>
+ <monitor>
+ <monitorspec>
+ <connector>DP-1</connector>
+ <vendor>MetaProduct's Inc.</vendor>
+ <product>MetaMonitor</product>
+ <serial>0x123456</serial>
+ </monitorspec>
+ <mode>
+ <width>800</width>
+ <height>600</height>
+ <rate>60</rate>
+ </mode>
+ </monitor>
+ </logicalmonitor>
+ <disabled>
+ <monitorspec>
+ <connector>DP-2</connector>
+ <vendor>MetaProduct's Inc.</vendor>
+ <product>MetaMonitor</product>
+ <serial>0x654321</serial>
+ </monitorspec>
+ </disabled>
+ </configuration>
+</monitors>
diff --git a/src/tests/migration/oneoff-new.xml b/src/tests/migration/oneoff-new.xml
new file mode 100644
index 0000000..1475c07
--- /dev/null
+++ b/src/tests/migration/oneoff-new.xml
@@ -0,0 +1,31 @@
+<monitors version="2">
+ <configuration>
+ <migrated/>
+ <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>800</width>
+ <height>600</height>
+ <rate>60</rate>
+ </mode>
+ </monitor>
+ </logicalmonitor>
+ <disabled>
+ <monitorspec>
+ <connector>DP-2</connector>
+ <vendor>MetaProduct's Inc.</vendor>
+ <product>MetaMonitor</product>
+ <serial>0x654321</serial>
+ </monitorspec>
+ </disabled>
+ </configuration>
+</monitors>
diff --git a/src/tests/migration/oneoff-old.xml b/src/tests/migration/oneoff-old.xml
new file mode 100644
index 0000000..185ecd6
--- /dev/null
+++ b/src/tests/migration/oneoff-old.xml
@@ -0,0 +1,26 @@
+<monitors version="1">
+ <configuration>
+ <clone>no</clone>
+ <output name="DP-1">
+ <vendor>MetaProduct's Inc.</vendor>
+ <product>MetaMonitor</product>
+ <serial>0x123456</serial>
+ <width>800</width>
+ <height>600</height>
+ <rate>60</rate>
+ <x>0</x>
+ <y>0</y>
+ <rotation>normal</rotation>
+ <reflect_x>no</reflect_x>
+ <reflect_y>no</reflect_y>
+ <primary>yes</primary>
+ <presentation>no</presentation>
+ <underscanning>no</underscanning>
+ </output>
+ <output name="DP-2">
+ <vendor>MetaProduct's Inc.</vendor>
+ <product>MetaMonitor</product>
+ <serial>0x654321</serial>
+ </output>
+ </configuration>
+</monitors>
diff --git a/src/tests/monitor-config-migration-unit-tests.c b/src/tests/monitor-config-migration-unit-tests.c
index 15c27b3..fa2beb4 100644
--- a/src/tests/monitor-config-migration-unit-tests.c
+++ b/src/tests/monitor-config-migration-unit-tests.c
@@ -106,6 +106,12 @@ meta_test_monitor_config_migration_first_rotated (void)
test_migration ("first-rotated-old.xml", "first-rotated-new.xml");
}
+static void
+meta_test_monitor_config_migration_oneoff (void)
+{
+ test_migration ("oneoff-old.xml", "oneoff-new.xml");
+}
+
void
init_monitor_config_migration_tests (void)
{
@@ -117,4 +123,6 @@ init_monitor_config_migration_tests (void)
meta_test_monitor_config_migration_tiled);
g_test_add_func ("/backends/monitor-config-migration/first-rotated",
meta_test_monitor_config_migration_first_rotated);
+ g_test_add_func ("/backends/monitor-config-migration/oneoff",
+ meta_test_monitor_config_migration_oneoff);
}
diff --git a/src/tests/monitor-configs/oneoff.xml b/src/tests/monitor-configs/oneoff.xml
new file mode 100644
index 0000000..4e5c6b7
--- /dev/null
+++ b/src/tests/monitor-configs/oneoff.xml
@@ -0,0 +1,31 @@
+<monitors version="2">
+ <configuration>
+ <logicalmonitor>
+ <x>0</x>
+ <y>0</y>
+ <scale>1</scale>
+ <primary>yes</primary>
+ <monitor>
+ <monitorspec>
+ <connector>DP-1</connector>
+ <vendor>MetaProduct's Inc.</vendor>
+ <product>MetaMonitor</product>
+ <serial>0x123456</serial>
+ </monitorspec>
+ <mode>
+ <width>800</width>
+ <height>600</height>
+ <rate>60</rate>
+ </mode>
+ </monitor>
+ </logicalmonitor>
+ <disabled>
+ <monitorspec>
+ <connector>DP-2</connector>
+ <vendor>MetaProduct's Inc.</vendor>
+ <product>MetaMonitor</product>
+ <serial>0x654321</serial>
+ </monitorspec>
+ </disabled>
+ </configuration>
+</monitors>
diff --git a/src/tests/monitor-unit-tests.c b/src/tests/monitor-unit-tests.c
index f5bd0a7..8863737 100644
--- a/src/tests/monitor-unit-tests.c
+++ b/src/tests/monitor-unit-tests.c
@@ -4696,6 +4696,135 @@ meta_test_monitor_custom_interlaced_config (void)
}
static void
+meta_test_monitor_custom_oneoff (void)
+{
+ MonitorTestCase test_case = {
+ .setup = {
+ .modes = {
+ {
+ .width = 800,
+ .height = 600,
+ .refresh_rate = 60.0
+ }
+ },
+ .n_modes = 1,
+ .outputs = {
+ {
+ .crtc = -1,
+ .modes = { 0 },
+ .n_modes = 1,
+ .preferred_mode = 0,
+ .possible_crtcs = { 0, 1 },
+ .n_possible_crtcs = 2,
+ .width_mm = 222,
+ .height_mm = 125
+ },
+ {
+ .crtc = -1,
+ .modes = { 0 },
+ .n_modes = 1,
+ .preferred_mode = 0,
+ .possible_crtcs = { 0, 1 },
+ .n_possible_crtcs = 2,
+ .width_mm = 222,
+ .height_mm = 125,
+ .serial = "0x654321"
+ }
+ },
+ .n_outputs = 2,
+ .crtcs = {
+ {
+ .current_mode = -1
+ },
+ {
+ .current_mode = -1
+ }
+ },
+ .n_crtcs = 2
+ },
+
+ .expect = {
+ .monitors = {
+ {
+ .outputs = { 0 },
+ .n_outputs = 1,
+ .modes = {
+ {
+ .width = 800,
+ .height = 600,
+ .refresh_rate = 60.0,
+ .crtc_modes = {
+ {
+ .output = 0,
+ .crtc_mode = 0
+ }
+ }
+ }
+ },
+ .n_modes = 1,
+ .current_mode = 0,
+ .width_mm = 222,
+ .height_mm = 125
+ },
+ {
+ .outputs = { 1 },
+ .n_outputs = 1,
+ .modes = {
+ {
+ .width = 800,
+ .height = 600,
+ .refresh_rate = 60.0,
+ .crtc_modes = {
+ {
+ .output = 1,
+ .crtc_mode = 0
+ }
+ }
+ }
+ },
+ .n_modes = 1,
+ .current_mode = -1,
+ .width_mm = 222,
+ .height_mm = 125
+ }
+ },
+ .n_monitors = 2,
+ .logical_monitors = {
+ {
+ .monitors = { 0 },
+ .n_monitors = 1,
+ .layout = { .x = 0, .y = 0, .width = 800, .height = 600 },
+ .scale = 1,
+ .transform = META_MONITOR_TRANSFORM_NORMAL
+ },
+ },
+ .n_logical_monitors = 1,
+ .primary_logical_monitor = 0,
+ .n_outputs = 2,
+ .crtcs = {
+ {
+ .current_mode = 0,
+ },
+ {
+ .current_mode = -1,
+ }
+ },
+ .n_crtcs = 2,
+ .screen_width = 800,
+ .screen_height = 600,
+ }
+ };
+ MetaMonitorTestSetup *test_setup;
+
+ test_setup = create_monitor_test_setup (&test_case,
+ MONITOR_TEST_FLAG_NONE);
+ set_custom_monitor_config ("oneoff.xml");
+ emulate_hotplug (test_setup);
+
+ check_monitor_configuration (&test_case);
+}
+
+static void
meta_test_monitor_migrated_rotated (void)
{
MonitorTestCase test_case = {
@@ -4928,6 +5057,8 @@ init_monitor_tests (void)
meta_test_monitor_custom_second_rotated_nonnative_config);
add_monitor_test ("/backends/monitor/custom/interlaced-config",
meta_test_monitor_custom_interlaced_config);
+ add_monitor_test ("/backends/monitor/custom/oneoff-config",
+ meta_test_monitor_custom_oneoff);
add_monitor_test ("/backends/monitor/migrated/rotated",
meta_test_monitor_migrated_rotated);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]