[mutter] tests: Add monitor transform config parsing tests
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] tests: Add monitor transform config parsing tests
- Date: Fri, 7 Apr 2017 14:36:05 +0000 (UTC)
commit dd14e1cebc6077f8f0b100ee4b2544d81b871429
Author: Jonas Ådahl <jadahl gmail com>
Date: Tue Mar 21 14:26:02 2017 +0800
tests: Add monitor transform config parsing tests
https://bugzilla.gnome.org/show_bug.cgi?id=777732
src/tests/monitor-configs/first-rotated.xml | 47 ++++++
src/tests/monitor-configs/second-rotated-tiled.xml | 43 +++++
src/tests/monitor-configs/second-rotated.xml | 43 +++++
src/tests/monitor-store-unit-tests.c | 162 ++++++++++++++++++++
4 files changed, 295 insertions(+), 0 deletions(-)
---
diff --git a/src/tests/monitor-configs/first-rotated.xml b/src/tests/monitor-configs/first-rotated.xml
new file mode 100644
index 0000000..f247975
--- /dev/null
+++ b/src/tests/monitor-configs/first-rotated.xml
@@ -0,0 +1,47 @@
+<monitors version="2">
+ <configuration>
+ <logicalmonitor>
+ <x>0</x>
+ <y>0</y>
+ <primary>yes</primary>
+ <transform>
+ <rotation>right</rotation>
+ <flipped>no</flipped>
+ </transform>
+ <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>768</x>
+ <y>0</y>
+ <transform>
+ <rotation>normal</rotation>
+ <flipped>no</flipped>
+ </transform>
+ <monitor>
+ <monitorspec>
+ <connector>DP-2</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>
+ </configuration>
+</monitors>
diff --git a/src/tests/monitor-configs/second-rotated-tiled.xml
b/src/tests/monitor-configs/second-rotated-tiled.xml
new file mode 100644
index 0000000..a8593d5
--- /dev/null
+++ b/src/tests/monitor-configs/second-rotated-tiled.xml
@@ -0,0 +1,43 @@
+<monitors version="2">
+ <configuration>
+ <logicalmonitor>
+ <x>0</x>
+ <y>256</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>1024</x>
+ <y>0</y>
+ <transform>
+ <rotation>left</rotation>
+ <flipped>no</flipped>
+ </transform>
+ <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-configs/second-rotated.xml b/src/tests/monitor-configs/second-rotated.xml
new file mode 100644
index 0000000..ee70c5e
--- /dev/null
+++ b/src/tests/monitor-configs/second-rotated.xml
@@ -0,0 +1,43 @@
+<monitors version="2">
+ <configuration>
+ <logicalmonitor>
+ <x>0</x>
+ <y>256</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>1024</x>
+ <y>0</y>
+ <transform>
+ <rotation>left</rotation>
+ <flipped>no</flipped>
+ </transform>
+ <monitor>
+ <monitorspec>
+ <connector>DP-2</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>
+ </configuration>
+</monitors>
diff --git a/src/tests/monitor-store-unit-tests.c b/src/tests/monitor-store-unit-tests.c
index 60aa872..121c0bb 100644
--- a/src/tests/monitor-store-unit-tests.c
+++ b/src/tests/monitor-store-unit-tests.c
@@ -52,6 +52,7 @@ typedef struct _MonitorTestCaseLogicalMonitor
{
MetaRectangle layout;
int scale;
+ MetaMonitorTransform transform;
gboolean is_primary;
gboolean is_presentation;
MonitorTestCaseMonitor monitors[MAX_N_MONITORS];
@@ -143,6 +144,9 @@ check_monitor_configuration (MetaMonitorConfigStore *config_store,
g_assert_cmpint (logical_monitor_config->scale,
==,
config_expect->logical_monitors[i].scale);
+ g_assert_cmpint (logical_monitor_config->transform,
+ ==,
+ config_expect->logical_monitors[i].transform);
g_assert_cmpint (logical_monitor_config->is_primary,
==,
config_expect->logical_monitors[i].is_primary);
@@ -571,6 +575,160 @@ meta_test_monitor_store_mirrored (void)
check_monitor_configurations (&expect);
}
+static void
+meta_test_monitor_store_first_rotated (void)
+{
+ MonitorStoreTestExpect expect = {
+ .configurations = {
+ {
+ .logical_monitors = {
+ {
+ .layout = {
+ .x = 0,
+ .y = 0,
+ .width = 768,
+ .height = 1024
+ },
+ .scale = 1,
+ .transform = META_MONITOR_TRANSFORM_270,
+ .is_primary = TRUE,
+ .is_presentation = FALSE,
+ .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 = 768,
+ .y = 0,
+ .width = 1024,
+ .height = 768
+ },
+ .scale = 1,
+ .transform = META_MONITOR_TRANSFORM_NORMAL,
+ .is_primary = FALSE,
+ .is_presentation = FALSE,
+ .monitors = {
+ {
+ .connector = "DP-2",
+ .vendor = "MetaProduct's Inc.",
+ .product = "MetaMonitor",
+ .serial = "0x123456",
+ .mode = {
+ .width = 1024,
+ .height = 768,
+ .refresh_rate = 60.000495910644531
+ }
+ }
+ },
+ .n_monitors = 1,
+ }
+ },
+ .n_logical_monitors = 2
+ }
+ },
+ .n_configurations = 1
+ };
+
+ if (!is_using_monitor_config_manager ())
+ {
+ g_test_skip ("Not using MetaMonitorConfigManager");
+ return;
+ }
+
+ set_custom_monitor_config ("first-rotated.xml");
+
+ check_monitor_configurations (&expect);
+}
+
+static void
+meta_test_monitor_store_second_rotated (void)
+{
+ MonitorStoreTestExpect expect = {
+ .configurations = {
+ {
+ .logical_monitors = {
+ {
+ .layout = {
+ .x = 0,
+ .y = 256,
+ .width = 1024,
+ .height = 768
+ },
+ .scale = 1,
+ .transform = META_MONITOR_TRANSFORM_NORMAL,
+ .is_primary = TRUE,
+ .is_presentation = FALSE,
+ .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 = 1024,
+ .y = 0,
+ .width = 768,
+ .height = 1024
+ },
+ .scale = 1,
+ .transform = META_MONITOR_TRANSFORM_90,
+ .is_primary = FALSE,
+ .is_presentation = FALSE,
+ .monitors = {
+ {
+ .connector = "DP-2",
+ .vendor = "MetaProduct's Inc.",
+ .product = "MetaMonitor",
+ .serial = "0x123456",
+ .mode = {
+ .width = 1024,
+ .height = 768,
+ .refresh_rate = 60.000495910644531
+ }
+ }
+ },
+ .n_monitors = 1,
+ }
+ },
+ .n_logical_monitors = 2
+ }
+ },
+ .n_configurations = 1
+ };
+
+ if (!is_using_monitor_config_manager ())
+ {
+ g_test_skip ("Not using MetaMonitorConfigManager");
+ return;
+ }
+
+ set_custom_monitor_config ("second-rotated.xml");
+
+ check_monitor_configurations (&expect);
+}
+
void
init_monitor_store_tests (void)
{
@@ -586,4 +744,8 @@ init_monitor_store_tests (void)
meta_test_monitor_store_scale);
g_test_add_func ("/backends/monitor-store/mirrored",
meta_test_monitor_store_mirrored);
+ g_test_add_func ("/backends/monitor-store/first-rotated",
+ meta_test_monitor_store_first_rotated);
+ g_test_add_func ("/backends/monitor-store/second-rotated",
+ meta_test_monitor_store_second_rotated);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]