diff options
| author | Berke Güzel <wenekar1@gmail.com> | 2026-10-13 16:24:56 +0300 |
|---|---|---|
| committer | Berke Güzel <wenekar1@gmail.com> | 2026-10-13 16:24:56 +0300 |
| commit | ed963bba0b234d52fda14b2a8237dbf02ef4d655 (patch) | |
| tree | 0c7bd51ff01089fbc810f94a55e0adb94084478e /tests/wayland/test_app_input.c | |
| parent | 4a61a0f8a749831b74aca04302a30ebbbb6f5586 (diff) | |
Quit on window close when the app has no event callback
Without yasl_app_desc.event, a close request had nowhere to go and the
window stayed open. The runner now stops instead, so hello drops its
event callback.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tests/wayland/test_app_input.c')
| -rw-r--r-- | tests/wayland/test_app_input.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/wayland/test_app_input.c b/tests/wayland/test_app_input.c index 843f38d..88f9ead 100644 --- a/tests/wayland/test_app_input.c +++ b/tests/wayland/test_app_input.c @@ -26,6 +26,15 @@ 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; + 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); + return YASL_APP_CONTINUE; + } if (state->end) { struct wayland_display *display = (struct wayland_display *)d; if (state->end == 1) @@ -107,5 +116,10 @@ int main(void) }); assert(end == 1 ? res == 0 : res < 0); } + state = (struct test_state){.end = 3}; + res = yasl_run(&(struct yasl_app_desc){ + .backend = YASL_BACKEND_WAYLAND, .userdata = &state, .init = on_init, + }); + assert(res == 0); return 0; } |
