tests/monitor-unit-tests: Check handling of odd tiled monitors

Add tests for handling tiled monitors where the origin tile output is
not the main output.

https://bugzilla.gnome.org/show_bug.cgi?id=781723
This commit is contained in:
Jonas Ådahl 2017-05-01 12:12:42 +08:00
parent 94d843b80e
commit fb5ebffb8d
2 changed files with 379 additions and 0 deletions

View File

@ -0,0 +1,22 @@
<monitors version="2">
<configuration>
<logicalmonitor>
<x>0</x>
<y>0</y>
<primary>yes</primary>
<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</rate>
</mode>
</monitor>
</logicalmonitor>
</configuration>
</monitors>

View File

@ -1343,6 +1343,182 @@ meta_test_monitor_tiled_linear_config (void)
check_monitor_configuration (&test_case); check_monitor_configuration (&test_case);
} }
static void
meta_test_monitor_tiled_non_preferred_linear_config (void)
{
MonitorTestCase test_case = {
.setup = {
.modes = {
{
.width = 640,
.height = 480,
.refresh_rate = 60.0
},
{
.width = 800,
.height = 600,
.refresh_rate = 60.0
},
{
.width = 512,
.height = 768,
.refresh_rate = 120.0
},
{
.width = 1024,
.height = 768,
.refresh_rate = 60.0
},
},
.n_modes = 4,
.outputs = {
{
.crtc = -1,
.modes = { 0, 2 },
.n_modes = 2,
.preferred_mode = 1,
.possible_crtcs = { 0 },
.n_possible_crtcs = 1,
.width_mm = 222,
.height_mm = 125,
.tile_info = {
.group_id = 1,
.max_h_tiles = 2,
.max_v_tiles = 1,
.loc_h_tile = 0,
.loc_v_tile = 0,
.tile_w = 512,
.tile_h = 768
}
},
{
.crtc = -1,
.modes = { 1, 2, 3 },
.n_modes = 3,
.preferred_mode = 0,
.possible_crtcs = { 1 },
.n_possible_crtcs = 1,
.width_mm = 222,
.height_mm = 125,
.tile_info = {
.group_id = 1,
.max_h_tiles = 2,
.max_v_tiles = 1,
.loc_h_tile = 1,
.loc_v_tile = 0,
.tile_w = 512,
.tile_h = 768
}
}
},
.n_outputs = 2,
.crtcs = {
{
.current_mode = -1
},
{
.current_mode = -1
}
},
.n_crtcs = 2
},
.expect = {
.monitors = {
{
.outputs = { 0, 1 },
.n_outputs = 2,
.modes = {
{
.width = 1024,
.height = 768,
.crtc_modes = {
{
.output = 0,
.crtc_mode = 2
},
{
.output = 1,
.crtc_mode = 2,
}
}
},
{
.width = 800,
.height = 600,
.crtc_modes = {
{
.output = 0,
.crtc_mode = -1
},
{
.output = 1,
.crtc_mode = 1,
}
}
},
{
.width = 1024,
.height = 768,
.crtc_modes = {
{
.output = 0,
.crtc_mode = -1
},
{
.output = 1,
.crtc_mode = 3,
}
}
},
},
.n_modes = 3,
.current_mode = 0,
.width_mm = 222,
.height_mm = 125,
}
},
.n_monitors = 1,
.logical_monitors = {
{
.monitors = { 0 },
.n_monitors = 1,
.layout = { .x = 0, .y = 0, .width = 1024, .height = 768 },
.scale = 1
},
},
.n_logical_monitors = 1,
.primary_logical_monitor = 0,
.n_outputs = 2,
.crtcs = {
{
.current_mode = 2,
},
{
.current_mode = 2,
.x = 512
}
},
.n_crtcs = 2,
.n_tiled_monitors = 1,
.screen_width = 1024,
.screen_height = 768,
}
};
MetaMonitorTestSetup *test_setup;
if (!is_using_monitor_config_manager ())
{
g_test_skip ("Only the new monitor config manager handles this case.");
return;
}
test_setup = create_monitor_test_setup (&test_case,
MONITOR_TEST_FLAG_NO_STORED);
emulate_hotplug (test_setup);
check_monitor_configuration (&test_case);
}
static void static void
meta_test_monitor_hidpi_linear_config (void) meta_test_monitor_hidpi_linear_config (void)
{ {
@ -3136,6 +3312,183 @@ meta_test_monitor_custom_tiled_custom_resolution_config (void)
check_monitor_configuration (&test_case); check_monitor_configuration (&test_case);
} }
static void
meta_test_monitor_custom_tiled_non_preferred_config (void)
{
MonitorTestCase test_case = {
.setup = {
.modes = {
{
.width = 640,
.height = 480,
.refresh_rate = 60.0
},
{
.width = 800,
.height = 600,
.refresh_rate = 60.0
},
{
.width = 512,
.height = 768,
.refresh_rate = 120.0
},
{
.width = 1024,
.height = 768,
.refresh_rate = 60.0
},
},
.n_modes = 4,
.outputs = {
{
.crtc = -1,
.modes = { 0, 2 },
.n_modes = 2,
.preferred_mode = 1,
.possible_crtcs = { 0 },
.n_possible_crtcs = 1,
.width_mm = 222,
.height_mm = 125,
.tile_info = {
.group_id = 1,
.max_h_tiles = 2,
.max_v_tiles = 1,
.loc_h_tile = 0,
.loc_v_tile = 0,
.tile_w = 512,
.tile_h = 768
}
},
{
.crtc = -1,
.modes = { 1, 2, 3 },
.n_modes = 3,
.preferred_mode = 0,
.possible_crtcs = { 1 },
.n_possible_crtcs = 1,
.width_mm = 222,
.height_mm = 125,
.tile_info = {
.group_id = 1,
.max_h_tiles = 2,
.max_v_tiles = 1,
.loc_h_tile = 1,
.loc_v_tile = 0,
.tile_w = 512,
.tile_h = 768
}
}
},
.n_outputs = 2,
.crtcs = {
{
.current_mode = -1
},
{
.current_mode = -1
}
},
.n_crtcs = 2
},
.expect = {
.monitors = {
{
.outputs = { 0, 1 },
.n_outputs = 2,
.modes = {
{
.width = 1024,
.height = 768,
.crtc_modes = {
{
.output = 0,
.crtc_mode = 2
},
{
.output = 1,
.crtc_mode = 2,
}
}
},
{
.width = 800,
.height = 600,
.crtc_modes = {
{
.output = 0,
.crtc_mode = -1
},
{
.output = 1,
.crtc_mode = 1,
}
}
},
{
.width = 1024,
.height = 768,
.crtc_modes = {
{
.output = 0,
.crtc_mode = -1
},
{
.output = 1,
.crtc_mode = 3,
}
}
},
},
.n_modes = 3,
.current_mode = 1,
.width_mm = 222,
.height_mm = 125,
}
},
.n_monitors = 1,
.logical_monitors = {
{
.monitors = { 0 },
.n_monitors = 1,
.layout = { .x = 0, .y = 0, .width = 800, .height = 600 },
.scale = 1
},
},
.n_logical_monitors = 1,
.primary_logical_monitor = 0,
.n_outputs = 2,
.crtcs = {
{
.current_mode = -1,
},
{
.current_mode = 1,
}
},
.n_crtcs = 2,
.n_tiled_monitors = 1,
.screen_width = 800,
.screen_height = 600,
}
};
MetaMonitorTestSetup *test_setup;
if (!is_using_monitor_config_manager ())
{
g_test_skip ("Only the new monitor config manager handles this case.");
return;
}
test_setup = create_monitor_test_setup (&test_case,
MONITOR_TEST_FLAG_NONE);
set_custom_monitor_config ("non-preferred-tiled-custom-resolution.xml");
emulate_hotplug (test_setup);
check_monitor_configuration (&test_case);
}
static void static void
meta_test_monitor_custom_mirrored_config (void) meta_test_monitor_custom_mirrored_config (void)
{ {
@ -3908,6 +4261,8 @@ init_monitor_tests (void)
meta_test_monitor_preferred_linear_config); meta_test_monitor_preferred_linear_config);
g_test_add_func ("/backends/monitor/tiled-linear-config", g_test_add_func ("/backends/monitor/tiled-linear-config",
meta_test_monitor_tiled_linear_config); meta_test_monitor_tiled_linear_config);
g_test_add_func ("/backends/monitor/tiled-non-preferred-linear-config",
meta_test_monitor_tiled_non_preferred_linear_config);
g_test_add_func ("/backends/monitor/hidpi-linear-config", g_test_add_func ("/backends/monitor/hidpi-linear-config",
meta_test_monitor_hidpi_linear_config); meta_test_monitor_hidpi_linear_config);
g_test_add_func ("/backends/monitor/suggested-config", g_test_add_func ("/backends/monitor/suggested-config",
@ -3937,6 +4292,8 @@ init_monitor_tests (void)
meta_test_monitor_custom_tiled_config); meta_test_monitor_custom_tiled_config);
g_test_add_func ("/backends/monitor/custom/tiled-custom-resolution-config", g_test_add_func ("/backends/monitor/custom/tiled-custom-resolution-config",
meta_test_monitor_custom_tiled_custom_resolution_config); meta_test_monitor_custom_tiled_custom_resolution_config);
g_test_add_func ("/backends/monitor/custom/tiled-non-preferred-config",
meta_test_monitor_custom_tiled_non_preferred_config);
g_test_add_func ("/backends/monitor/custom/mirrored-config", g_test_add_func ("/backends/monitor/custom/mirrored-config",
meta_test_monitor_custom_mirrored_config); meta_test_monitor_custom_mirrored_config);
g_test_add_func ("/backends/monitor/custom/first-rotated-config", g_test_add_func ("/backends/monitor/custom/first-rotated-config",