mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 23:50:41 -05:00
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
This commit is contained in:
parent
efdbeb7c1b
commit
99e1cd549d
31
src/tests/migration/oneoff-new-finished.xml
Normal file
31
src/tests/migration/oneoff-new-finished.xml
Normal file
@ -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>
|
31
src/tests/migration/oneoff-new.xml
Normal file
31
src/tests/migration/oneoff-new.xml
Normal file
@ -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>
|
26
src/tests/migration/oneoff-old.xml
Normal file
26
src/tests/migration/oneoff-old.xml
Normal file
@ -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>
|
@ -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);
|
||||
}
|
||||
|
31
src/tests/monitor-configs/oneoff.xml
Normal file
31
src/tests/monitor-configs/oneoff.xml
Normal file
@ -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>
|
@ -4695,6 +4695,135 @@ meta_test_monitor_custom_interlaced_config (void)
|
||||
check_monitor_configuration (&test_case);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user