tests/kms-update: Add mode setting sanity tests

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2159>
This commit is contained in:
Jonas Ådahl 2021-06-16 14:17:47 +02:00 committed by Marge Bot
parent 65073c145c
commit 4276e9ddd3
2 changed files with 36 additions and 0 deletions

View File

@ -109,6 +109,7 @@ void meta_kms_update_set_privacy_screen (MetaKmsUpdate *update,
void meta_kms_update_set_power_save (MetaKmsUpdate *update);
META_EXPORT_TEST
void meta_kms_update_mode_set (MetaKmsUpdate *update,
MetaKmsCrtc *crtc,
GList *connectors,

View File

@ -209,6 +209,39 @@ meta_test_kms_update_fixed16 (void)
g_assert_cmpint (rect16.height, ==, 26214400);
}
static void
meta_test_kms_update_mode_sets (void)
{
MetaKmsDevice *device;
MetaKmsUpdate *update;
MetaKmsCrtc *crtc;
MetaKmsConnector *connector;
MetaKmsMode *mode;
GList *mode_sets;
MetaKmsModeSet *mode_set;
device = meta_get_test_kms_device (test_context);
update = meta_kms_update_new (device);
crtc = meta_get_test_kms_crtc (device);
connector = meta_get_test_kms_connector (device);
mode = get_preferred_mode (connector);
meta_kms_update_mode_set (update, crtc,
g_list_append (NULL, connector),
mode);
mode_sets = meta_kms_update_get_mode_sets (update);
g_assert_cmpuint (g_list_length (mode_sets), ==, 1);
mode_set = mode_sets->data;
g_assert (mode_set->crtc == crtc);
g_assert_cmpuint (g_list_length (mode_set->connectors), ==, 1);
g_assert (mode_set->connectors->data == connector);
g_assert (mode_set->mode == mode);
meta_kms_update_free (update);
}
static void
init_tests (void)
{
@ -218,6 +251,8 @@ init_tests (void)
meta_test_kms_update_fixed16);
g_test_add_func ("/backends/native/kms/update/plane-assignments",
meta_test_kms_update_plane_assignments);
g_test_add_func ("/backends/native/kms/update/mode-sets",
meta_test_kms_update_mode_sets);
}
int