tests/wayland: Add lease without connectors error test
Add a test that: - Creates a client - Creates and submits a lease without connectors - Check that the compositor returns the correct error Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4031>
This commit is contained in:
parent
973454dbdd
commit
562beb9314
2 changed files with 44 additions and 0 deletions
|
@ -100,6 +100,21 @@ test_drm_lease_lease_duplicated_connector (void)
|
|||
g_test_assert_expected_messages ();
|
||||
}
|
||||
|
||||
static void
|
||||
test_drm_lease_lease_no_connectors (void)
|
||||
{
|
||||
MetaWaylandTestClient *wayland_test_client;
|
||||
|
||||
wayland_test_client = meta_wayland_test_client_new_with_args (test_context,
|
||||
"drm-lease",
|
||||
"lease-no-connectors",
|
||||
NULL);
|
||||
g_test_expect_message ("libmutter", G_LOG_LEVEL_WARNING,
|
||||
"WL: error in client communication*");
|
||||
meta_wayland_test_client_finish (wayland_test_client);
|
||||
g_test_assert_expected_messages ();
|
||||
}
|
||||
|
||||
static void
|
||||
init_tests (void)
|
||||
{
|
||||
|
@ -113,6 +128,8 @@ init_tests (void)
|
|||
test_drm_lease_lease_leased_connector);
|
||||
g_test_add_func ("/wayland/drm-lease/lease-duplicated-connector",
|
||||
test_drm_lease_lease_duplicated_connector);
|
||||
g_test_add_func ("/wayland/drm-lease/lease-no-connectors",
|
||||
test_drm_lease_lease_no_connectors);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -743,6 +743,31 @@ test_drm_lease_lease_duplicated_connector (WaylandDisplay *display)
|
|||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
static int
|
||||
test_drm_lease_lease_no_connectors (WaylandDisplay *display)
|
||||
{
|
||||
DrmLeaseClient *client;
|
||||
DrmLeaseLease *lease;
|
||||
|
||||
/* Create and submit lease without connectors */
|
||||
client = drm_lease_client_new (display);
|
||||
lease = drm_lease_lease_new (client, 0, NULL, 0);
|
||||
|
||||
drm_lease_lease_submit (lease);
|
||||
|
||||
/* Check that the correct error is returned */
|
||||
g_assert_cmpint (wl_display_roundtrip (display->display), ==, -1);
|
||||
g_assert_cmpint (wl_display_get_error (display->display), ==, EPROTO);
|
||||
g_assert_cmpint (wl_display_get_protocol_error (display->display, NULL, NULL),
|
||||
==,
|
||||
WP_DRM_LEASE_REQUEST_V1_ERROR_EMPTY_LEASE);
|
||||
|
||||
drm_lease_lease_free (lease);
|
||||
drm_lease_client_free (client);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc,
|
||||
char **argv)
|
||||
|
@ -766,6 +791,8 @@ main (int argc,
|
|||
return test_drm_lease_lease_leased_connector (display);
|
||||
else if (g_strcmp0 (test_case, "lease-duplicated-connector") == 0)
|
||||
return test_drm_lease_lease_duplicated_connector (display);
|
||||
else if (g_strcmp0 (test_case, "lease-no-connectors") == 0)
|
||||
return test_drm_lease_lease_no_connectors (display);
|
||||
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue