summaryrefslogtreecommitdiff
path: root/tests/wayland/test_app_input.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/wayland/test_app_input.c')
-rw-r--r--tests/wayland/test_app_input.c17
1 files changed, 12 insertions, 5 deletions
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 <assert.h>
+#include <errno.h>
#include <stdlib.h>
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);