From 702facbc9111ede0c551a2ffa17eace7689b69ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Thu, 12 Jan 2017 16:36:45 +0800 Subject: [PATCH] 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(+) create mode 100644 src/tests/monitor-configs/vertical.xml diff --git a/src/tests/monitor-configs/vertical.xml b/src/tests/monitor-configs/vertical.xml new file mode 100644 index 000000000..76f11297b --- /dev/null +++ b/src/tests/monitor-configs/vertical.xml @@ -0,0 +1,39 @@ + + + + 0 + 0 + yes + + + DP-1 + MetaProduct's Inc. + MetaMonitor + 0x123456 + + + 1024 + 768 + 60.000495910644531 + + + + + 0 + 768 + + + DP-2 + MetaProduct's Inc. + MetaMonitor + 0x123456 + + + 800 + 600 + 60.000495910644531 + + + + + diff --git a/src/tests/monitor-store-unit-tests.c b/src/tests/monitor-store-unit-tests.c index 5b2e8cf75..3d6a6470f 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); }