From dd1775a9927922c14f8679ccbc4d3ca8d5917e20 Mon Sep 17 00:00:00 2001 From: Berke Güzel Date: Tue, 13 Oct 2026 21:23:03 +0300 Subject: public api refactor --- tests/wayland/test_app_input.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'tests/wayland/test_app_input.c') diff --git a/tests/wayland/test_app_input.c b/tests/wayland/test_app_input.c index 88f9ead..7e0e9a0 100644 --- a/tests/wayland/test_app_input.c +++ b/tests/wayland/test_app_input.c @@ -5,9 +5,11 @@ #include "yasl/app.h" #include +#include #include struct test_state { + bool initialized; int keys; int buttons, motions, resets; int end; @@ -26,21 +28,20 @@ static void push_key(struct yasl_surface *s) static enum yasl_app_result on_init(void *ud, struct yasl_display *d) { struct test_state *state = ud; + state->initialized = true; if (state->end == 3) { /* With no event callback, a close request alone stops the runner. */ struct yasl_surface *s = yasl_surface_create_toplevel(d, &(struct yasl_window_spec){ .title = "App Close Test", .size = {64, 64} }); assert(s); - struct wayland_surface *w = (struct wayland_surface *)s; - w->cbs->close(s, w->ud); + yasl_surface_notify_close(s); return YASL_APP_CONTINUE; } if (state->end) { - struct wayland_display *display = (struct wayland_display *)d; if (state->end == 1) - display->cbs->quit(display->ud); + yasl_display_notify_event(d, YASL_EVENT_DISPLAY_QUIT); else - display->cbs->lost(display->ud); + yasl_display_notify_event(d, YASL_EVENT_DISPLAY_LOST); return YASL_APP_CONTINUE; } struct yasl_surface *s = yasl_surface_create_toplevel(d, @@ -106,6 +107,12 @@ int main(void) .init = on_init, .event = on_event, }); + /* A display variable may exist even when the test sandbox cannot connect + * to that compositor. Keep this as an integration test in that case. */ + if (res < 0 && !state.initialized && + (errno == EACCES || errno == EPERM || errno == ENOENT || + errno == ECONNREFUSED || errno == ENODEV)) + return 77; assert(res == 0); assert(state.keys == 1); assert(state.buttons == 1 && state.motions == 2 && state.resets == 1); -- cgit v1.2.3