tests: Add test for setting an interlaced monitor mode
https://bugzilla.gnome.org/show_bug.cgi?id=765011
This commit is contained in:
parent
49c5228655
commit
4cc5b25493
23
src/tests/monitor-configs/interlaced.xml
Normal file
23
src/tests/monitor-configs/interlaced.xml
Normal file
@ -0,0 +1,23 @@
|
||||
<monitors version="2">
|
||||
<configuration>
|
||||
<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>1024</width>
|
||||
<height>768</height>
|
||||
<rate>60.000495910644531</rate>
|
||||
<flag>interlace</flag>
|
||||
</mode>
|
||||
</monitor>
|
||||
</logicalmonitor>
|
||||
</configuration>
|
||||
</monitors>
|
@ -189,6 +189,9 @@ check_monitor_configuration (MetaMonitorConfigStore *config_store,
|
||||
g_assert_cmpfloat (monitor_config->mode_spec->refresh_rate,
|
||||
==,
|
||||
test_monitor->mode.refresh_rate);
|
||||
g_assert_cmpint (monitor_config->mode_spec->flags,
|
||||
==,
|
||||
test_monitor->mode.flags);
|
||||
g_assert_cmpint (monitor_config->enable_underscanning,
|
||||
==,
|
||||
test_monitor->is_underscanning);
|
||||
@ -848,6 +851,57 @@ meta_test_monitor_store_second_rotated (void)
|
||||
check_monitor_configurations (&expect);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_test_monitor_store_interlaced (void)
|
||||
{
|
||||
MonitorStoreTestExpect expect = {
|
||||
.configurations = {
|
||||
{
|
||||
.logical_monitors = {
|
||||
{
|
||||
.layout = {
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.width = 1024,
|
||||
.height = 768
|
||||
},
|
||||
.scale = 1,
|
||||
.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,
|
||||
.flags = META_CRTC_MODE_FLAG_INTERLACE,
|
||||
}
|
||||
}
|
||||
},
|
||||
.n_monitors = 1,
|
||||
},
|
||||
},
|
||||
.n_logical_monitors = 1
|
||||
}
|
||||
},
|
||||
.n_configurations = 1
|
||||
};
|
||||
|
||||
if (!is_using_monitor_config_manager ())
|
||||
{
|
||||
g_test_skip ("Not using MetaMonitorConfigManager");
|
||||
return;
|
||||
}
|
||||
|
||||
set_custom_monitor_config ("interlaced.xml");
|
||||
|
||||
check_monitor_configurations (&expect);
|
||||
}
|
||||
|
||||
void
|
||||
init_monitor_store_tests (void)
|
||||
{
|
||||
@ -871,4 +925,6 @@ init_monitor_store_tests (void)
|
||||
meta_test_monitor_store_first_rotated);
|
||||
g_test_add_func ("/backends/monitor-store/second-rotated",
|
||||
meta_test_monitor_store_second_rotated);
|
||||
g_test_add_func ("/backends/monitor-store/interlaced",
|
||||
meta_test_monitor_store_interlaced);
|
||||
}
|
||||
|
@ -89,6 +89,7 @@ typedef struct _MonitorTestCaseMode
|
||||
int width;
|
||||
int height;
|
||||
float refresh_rate;
|
||||
MetaCrtcModeFlag flags;
|
||||
} MonitorTestCaseMode;
|
||||
|
||||
typedef struct _MonitorTestCaseOutput
|
||||
@ -135,6 +136,7 @@ typedef struct _MonitorTestCaseMonitorMode
|
||||
int width;
|
||||
int height;
|
||||
float refresh_rate;
|
||||
MetaCrtcModeFlag flags;
|
||||
MetaTestCaseMonitorCrtcMode crtc_modes[MAX_N_CRTCS];
|
||||
} MetaMonitorTestCaseMonitorMode;
|
||||
|
||||
@ -360,10 +362,13 @@ check_monitor_mode (MetaMonitor *monitor,
|
||||
if (crtc_mode)
|
||||
{
|
||||
float refresh_rate;
|
||||
MetaCrtcModeFlag flags;
|
||||
|
||||
refresh_rate = meta_monitor_mode_get_refresh_rate (mode);
|
||||
flags = meta_monitor_mode_get_flags (mode);
|
||||
|
||||
g_assert_cmpfloat (refresh_rate, ==, crtc_mode->refresh_rate);
|
||||
g_assert_cmpint (flags, ==, crtc_mode->flags);
|
||||
}
|
||||
|
||||
data->expect_crtc_mode_iter++;
|
||||
@ -627,10 +632,12 @@ check_monitor_configuration (MonitorTestCase *test_case)
|
||||
int width;
|
||||
int height;
|
||||
float refresh_rate;
|
||||
MetaCrtcModeFlag flags;
|
||||
CheckMonitorModeData data;
|
||||
|
||||
meta_monitor_mode_get_resolution (mode, &width, &height);
|
||||
refresh_rate = meta_monitor_mode_get_refresh_rate (mode);
|
||||
flags = meta_monitor_mode_get_flags (mode);
|
||||
|
||||
g_assert_cmpint (width,
|
||||
==,
|
||||
@ -641,6 +648,9 @@ check_monitor_configuration (MonitorTestCase *test_case)
|
||||
g_assert_cmpfloat (refresh_rate,
|
||||
==,
|
||||
test_case->expect.monitors[i].modes[j].refresh_rate);
|
||||
g_assert_cmpint (flags,
|
||||
==,
|
||||
test_case->expect.monitors[i].modes[j].flags);
|
||||
|
||||
data = (CheckMonitorModeData) {
|
||||
.monitor_manager = monitor_manager,
|
||||
@ -803,7 +813,8 @@ create_monitor_test_setup (MonitorTestCase *test_case,
|
||||
.mode_id = i,
|
||||
.width = test_case->setup.modes[i].width,
|
||||
.height = test_case->setup.modes[i].height,
|
||||
.refresh_rate = test_case->setup.modes[i].refresh_rate
|
||||
.refresh_rate = test_case->setup.modes[i].refresh_rate,
|
||||
.flags = test_case->setup.modes[i].flags,
|
||||
};
|
||||
}
|
||||
|
||||
@ -4514,6 +4525,122 @@ meta_test_monitor_custom_second_rotated_nonnative_config (void)
|
||||
check_monitor_configuration (&test_case);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_test_monitor_custom_interlaced_config (void)
|
||||
{
|
||||
MonitorTestCase test_case = {
|
||||
.setup = {
|
||||
.modes = {
|
||||
{
|
||||
.width = 1024,
|
||||
.height = 768,
|
||||
.refresh_rate = 60.000495910644531
|
||||
},
|
||||
{
|
||||
.width = 1024,
|
||||
.height = 768,
|
||||
.refresh_rate = 60.000495910644531,
|
||||
.flags = META_CRTC_MODE_FLAG_INTERLACE,
|
||||
}
|
||||
},
|
||||
.n_modes = 2,
|
||||
.outputs = {
|
||||
{
|
||||
.crtc = 0,
|
||||
.modes = { 0, 1 },
|
||||
.n_modes = 2,
|
||||
.preferred_mode = 0,
|
||||
.possible_crtcs = { 0 },
|
||||
.n_possible_crtcs = 1,
|
||||
.width_mm = 222,
|
||||
.height_mm = 125
|
||||
},
|
||||
},
|
||||
.n_outputs = 1,
|
||||
.crtcs = {
|
||||
{
|
||||
.current_mode = 0
|
||||
},
|
||||
},
|
||||
.n_crtcs = 1
|
||||
},
|
||||
|
||||
.expect = {
|
||||
.monitors = {
|
||||
{
|
||||
.outputs = { 0 },
|
||||
.n_outputs = 1,
|
||||
.modes = {
|
||||
{
|
||||
.width = 1024,
|
||||
.height = 768,
|
||||
.refresh_rate = 60.000495910644531,
|
||||
.flags = META_CRTC_MODE_FLAG_NONE,
|
||||
.crtc_modes = {
|
||||
{
|
||||
.output = 0,
|
||||
.crtc_mode = 0,
|
||||
},
|
||||
}
|
||||
},
|
||||
{
|
||||
.width = 1024,
|
||||
.height = 768,
|
||||
.refresh_rate = 60.000495910644531,
|
||||
.flags = META_CRTC_MODE_FLAG_INTERLACE,
|
||||
.crtc_modes = {
|
||||
{
|
||||
.output = 0,
|
||||
.crtc_mode = 1,
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
.n_modes = 2,
|
||||
.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 = 1024, .height = 768 },
|
||||
.scale = 1
|
||||
}
|
||||
},
|
||||
.n_logical_monitors = 1,
|
||||
.primary_logical_monitor = 0,
|
||||
.n_outputs = 1,
|
||||
.crtcs = {
|
||||
{
|
||||
.current_mode = 1,
|
||||
}
|
||||
},
|
||||
.n_crtcs = 1,
|
||||
.n_tiled_monitors = 0,
|
||||
.screen_width = 1024,
|
||||
.screen_height = 768
|
||||
}
|
||||
};
|
||||
MetaMonitorTestSetup *test_setup;
|
||||
|
||||
if (!is_using_monitor_config_manager ())
|
||||
{
|
||||
g_test_skip ("Not using MetaMonitorConfigManager");
|
||||
return;
|
||||
}
|
||||
|
||||
test_setup = create_monitor_test_setup (&test_case,
|
||||
MONITOR_TEST_FLAG_NONE);
|
||||
set_custom_monitor_config ("interlaced.xml");
|
||||
emulate_hotplug (test_setup);
|
||||
|
||||
check_monitor_configuration (&test_case);
|
||||
}
|
||||
|
||||
void
|
||||
init_monitor_tests (void)
|
||||
{
|
||||
@ -4580,4 +4707,6 @@ init_monitor_tests (void)
|
||||
meta_test_monitor_custom_second_rotated_tiled_config);
|
||||
g_test_add_func ("/backends/monitor/custom/second-rotated-nonnative-config",
|
||||
meta_test_monitor_custom_second_rotated_nonnative_config);
|
||||
g_test_add_func ("/backends/monitor/custom/interlaced-config",
|
||||
meta_test_monitor_custom_interlaced_config);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user