mirror of
https://github.com/brl/mutter.git
synced 2025-02-23 16:34:10 +00:00
tests: Add monitor transform config parsing tests
https://bugzilla.gnome.org/show_bug.cgi?id=777732
This commit is contained in:
parent
1e2266aa47
commit
dd14e1cebc
47
src/tests/monitor-configs/first-rotated.xml
Normal file
47
src/tests/monitor-configs/first-rotated.xml
Normal file
@ -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>
|
43
src/tests/monitor-configs/second-rotated-tiled.xml
Normal file
43
src/tests/monitor-configs/second-rotated-tiled.xml
Normal file
@ -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>
|
43
src/tests/monitor-configs/second-rotated.xml
Normal file
43
src/tests/monitor-configs/second-rotated.xml
Normal file
@ -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>
|
@ -52,6 +52,7 @@ typedef struct _MonitorTestCaseLogicalMonitor
|
|||||||
{
|
{
|
||||||
MetaRectangle layout;
|
MetaRectangle layout;
|
||||||
int scale;
|
int scale;
|
||||||
|
MetaMonitorTransform transform;
|
||||||
gboolean is_primary;
|
gboolean is_primary;
|
||||||
gboolean is_presentation;
|
gboolean is_presentation;
|
||||||
MonitorTestCaseMonitor monitors[MAX_N_MONITORS];
|
MonitorTestCaseMonitor monitors[MAX_N_MONITORS];
|
||||||
@ -143,6 +144,9 @@ check_monitor_configuration (MetaMonitorConfigStore *config_store,
|
|||||||
g_assert_cmpint (logical_monitor_config->scale,
|
g_assert_cmpint (logical_monitor_config->scale,
|
||||||
==,
|
==,
|
||||||
config_expect->logical_monitors[i].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,
|
g_assert_cmpint (logical_monitor_config->is_primary,
|
||||||
==,
|
==,
|
||||||
config_expect->logical_monitors[i].is_primary);
|
config_expect->logical_monitors[i].is_primary);
|
||||||
@ -571,6 +575,160 @@ meta_test_monitor_store_mirrored (void)
|
|||||||
check_monitor_configurations (&expect);
|
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
|
void
|
||||||
init_monitor_store_tests (void)
|
init_monitor_store_tests (void)
|
||||||
{
|
{
|
||||||
@ -586,4 +744,8 @@ init_monitor_store_tests (void)
|
|||||||
meta_test_monitor_store_scale);
|
meta_test_monitor_store_scale);
|
||||||
g_test_add_func ("/backends/monitor-store/mirrored",
|
g_test_add_func ("/backends/monitor-store/mirrored",
|
||||||
meta_test_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);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user