tests/monitor-unit-tests: Sanity check some monitor info

Check that some information about the monitor is the same as the main
output they are derived from.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1689>
This commit is contained in:
Jonas Ådahl 2021-01-26 16:07:07 +01:00 committed by Marge Bot
parent 432682f305
commit b883a31796
2 changed files with 16 additions and 0 deletions

View File

@ -164,6 +164,7 @@ int meta_output_get_backlight (MetaOutput *output);
void meta_output_add_possible_clone (MetaOutput *output,
MetaOutput *possible_clone);
META_EXPORT_TEST
const MetaOutputInfo * meta_output_get_info (MetaOutput *output);
META_EXPORT_TEST

View File

@ -365,6 +365,8 @@ check_monitor_configuration (MonitorTestCaseExpect *expect)
for (l = monitors, i = 0; l; l = l->next, i++)
{
MetaMonitor *monitor = l->data;
MetaOutput *main_output;
const MetaOutputInfo *main_output_info;
GList *outputs;
GList *l_output;
int j;
@ -400,6 +402,19 @@ check_monitor_configuration (MonitorTestCaseExpect *expect)
==,
expect->monitors[i].height_mm);
main_output = meta_monitor_get_main_output (monitor);
main_output_info = meta_output_get_info (main_output);
g_assert_cmpstr (meta_monitor_get_connector (monitor), ==,
main_output_info->name);
g_assert_cmpstr (meta_monitor_get_vendor (monitor), ==,
main_output_info->vendor);
g_assert_cmpstr (meta_monitor_get_product (monitor), ==,
main_output_info->product);
g_assert_cmpstr (meta_monitor_get_serial (monitor), ==,
main_output_info->serial);
g_assert_cmpint (meta_monitor_get_connector_type (monitor), ==,
main_output_info->connector_type);
modes = meta_monitor_get_modes (monitor);
g_assert_cmpint (g_list_length (modes),
==,