diff --git a/src/tests/wayland-drm-lease-tests.c b/src/tests/wayland-drm-lease-tests.c index 1d0a9cb54..81c4f0388 100644 --- a/src/tests/wayland-drm-lease-tests.c +++ b/src/tests/wayland-drm-lease-tests.c @@ -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 diff --git a/src/tests/wayland-test-clients/drm-lease.c b/src/tests/wayland-test-clients/drm-lease.c index 691d77d53..b47d8aa7d 100644 --- a/src/tests/wayland-test-clients/drm-lease.c +++ b/src/tests/wayland-test-clients/drm-lease.c @@ -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; }