summaryrefslogtreecommitdiff
path: root/tests/common
diff options
context:
space:
mode:
Diffstat (limited to 'tests/common')
-rw-r--r--tests/common/test_app.c12
-rw-r--r--tests/common/test_backends.c86
-rw-r--r--tests/common/test_contracts.c36
-rw-r--r--tests/common/test_input_alloc.c15
-rw-r--r--tests/common/test_tablet_example.c49
5 files changed, 96 insertions, 102 deletions
diff --git a/tests/common/test_app.c b/tests/common/test_app.c
index 23c9a93..6972921 100644
--- a/tests/common/test_app.c
+++ b/tests/common/test_app.c
@@ -37,7 +37,7 @@ static uint64_t on_timer(void *ud, yasl_timer_id id, uint64_t interval_ns)
return 0; /* one-shot */
}
-static int on_init(void *ud, struct yasl_display *d)
+static enum yasl_app_result on_init(void *ud, struct yasl_display *d)
{
struct test_state *state = ud;
state->display = d;
@@ -51,8 +51,8 @@ static int on_init(void *ud, struct yasl_display *d)
assert(state->surface != NULL);
yasl_surface_set_pacing(state->surface, YASL_PACING_ON_DEMAND);
- yasl_surface_set_mouse_mode(state->surface, YASL_MOUSE_RELATIVE);
- yasl_surface_set_mouse_mode(state->surface, YASL_MOUSE_NORMAL);
+ yasl_surface_set_pointer_mode(state->surface, YASL_POINTER_RELATIVE);
+ yasl_surface_set_pointer_mode(state->surface, YASL_POINTER_NORMAL);
state->timer_id = yasl_app_add_timer(d, YASL_MS_TO_NS(20), on_timer, state);
assert(state->timer_id > 0);
@@ -66,15 +66,15 @@ static int on_init(void *ud, struct yasl_display *d)
return YASL_APP_CONTINUE;
}
-static int on_event(void *ud, const struct yasl_event *ev)
+static enum yasl_app_result on_event(void *ud, const struct yasl_event *ev)
{
struct test_state *state = ud;
if (ev->type == YASL_EVENT_USER) {
- assert(ev->user.type == 42);
+ assert(ev->user.code == 42);
assert(ev->user.payload == (void *)0x1234);
state->user_event_called = true;
yasl_surface_request_frame(state->surface);
- } else if (ev->type == YASL_EVENT_WINDOW_CLOSE_REQUEST) {
+ } else if (ev->type == YASL_EVENT_WINDOW_CLOSE) {
return YASL_APP_QUIT;
}
return YASL_APP_CONTINUE;
diff --git a/tests/common/test_backends.c b/tests/common/test_backends.c
index 28f2f52..74860c8 100644
--- a/tests/common/test_backends.c
+++ b/tests/common/test_backends.c
@@ -191,17 +191,17 @@ static void x11_behavior(struct yasl_loop *loop, struct yasl_display *d, struct
assert(size.x == 200 && size.y == 120);
/* A server-generated motion verifies the XI2 subscription and cookie
* dispatch path, including source-device lookup, rather than SendEvent. */
- struct yasl_input_event pointer_event;
- while (yasl_surface_input_poll(w->surface, &pointer_event)) {}
+ struct yasl_event pointer_event;
+ while (yasl_surface_poll_event(w->surface, &pointer_event)) {}
XWarpPointer(native, None, window, 0, 0, 0, 0, 80, 50);
XFlush(native);
pump(loop, d, NULL);
bool saw_motion = false;
- while (yasl_surface_input_poll(w->surface, &pointer_event)) {
- if (pointer_event.kind == YASL_INPUT_MOUSE && pointer_event.mouse.kind == YASL_PTR_MOTION) {
- assert(pointer_event.mouse.device == YASL_PTR_DEV_MOUSE);
- assert(!pointer_event.mouse.pen.pressure);
- if (pointer_event.mouse.pos.x == 80 && pointer_event.mouse.pos.y == 50)
+ while (yasl_surface_poll_event(w->surface, &pointer_event)) {
+ if (pointer_event.type == YASL_EVENT_POINTER_MOTION) {
+ assert(pointer_event.pointer.device == YASL_PTR_DEV_MOUSE);
+ assert(!pointer_event.pointer.pen.pressure);
+ if (pointer_event.pointer.pos.x == 80 && pointer_event.pointer.pos.y == 50)
saw_motion = true;
}
}
@@ -216,22 +216,22 @@ static void x11_behavior(struct yasl_loop *loop, struct yasl_display *d, struct
yasl_display_paste(d, YASL_CLIPBOARD, w->surface);
pump(loop, d, NULL);
bool saw_key = false, saw_paste = false, saw_text = false;
- struct yasl_input_event event;
- while (yasl_surface_input_poll(w->surface, &event)) {
+ struct yasl_event event;
+ while (yasl_surface_poll_event(w->surface, &event)) {
assert(event.surface == w->surface);
- if (event.kind == YASL_INPUT_KEY) {
+ if (event.type == YASL_EVENT_KEY) {
assert(event.key.codepoint == 'a');
assert(event.key.shifted == 'A');
assert(event.key.native_code == key.xkey.keycode);
saw_key = event.key.key == YASL_KEY_A;
}
- if (event.kind == YASL_INPUT_PASTE) {
- assert(event.paste.len == strlen("clipboard text"));
- assert(memcmp(event.paste.text, "clipboard text", event.paste.len) == 0);
+ if (event.type == YASL_EVENT_PASTE) {
+ assert(event.text.len == strlen("clipboard text"));
+ assert(memcmp(event.text.data, "clipboard text", event.text.len) == 0);
saw_paste = true;
}
- if (event.kind == YASL_INPUT_TEXT) {
- assert(event.text.len == 1 && event.text.text[0] == 'a');
+ if (event.type == YASL_EVENT_TEXT) {
+ assert(event.text.len == 1 && event.text.data[0] == 'a');
saw_text = true;
}
}
@@ -246,13 +246,13 @@ static void x11_behavior(struct yasl_loop *loop, struct yasl_display *d, struct
XFlush(native);
pump(loop, d, NULL);
int key_count = 0, text_count = 0;
- while (yasl_surface_input_poll(w->surface, &event)) {
- if (event.kind == YASL_INPUT_KEY) {
+ while (yasl_surface_poll_event(w->surface, &event)) {
+ if (event.type == YASL_EVENT_KEY) {
assert(event.key.key == YASL_KEY_A);
assert(event.key.action == (key_count ? YASL_KEY_RELEASE : YASL_KEY_PRESS));
key_count++;
- } else if (event.kind == YASL_INPUT_TEXT) {
- assert(event.text.len == 1 && event.text.text[0] == 'A');
+ } else if (event.type == YASL_EVENT_TEXT) {
+ assert(event.text.len == 1 && event.text.data[0] == 'A');
text_count++;
}
}
@@ -262,10 +262,10 @@ static void x11_behavior(struct yasl_loop *loop, struct yasl_display *d, struct
XSendEvent(native, window, False, KeyPressMask, &key);
XFlush(native);
pump(loop, d, NULL);
- assert(yasl_surface_input_poll(w->surface, &event));
- assert(event.kind == YASL_INPUT_KEY && event.key.key == YASL_KEY_A);
+ assert(yasl_surface_poll_event(w->surface, &event));
+ assert(event.type == YASL_EVENT_KEY && event.key.key == YASL_KEY_A);
assert(event.key.mods & YASL_MOD_CTRL);
- assert(!yasl_surface_input_poll(w->surface, &event));
+ assert(!yasl_surface_poll_event(w->surface, &event));
int symbols_per_key = 0;
KeySym *saved_symbols = XGetKeyboardMapping(native, key.xkey.keycode, 1, &symbols_per_key);
@@ -282,12 +282,12 @@ static void x11_behavior(struct yasl_loop *loop, struct yasl_display *d, struct
XFlush(native);
pump(loop, d, NULL);
saw_key = saw_text = false;
- while (yasl_surface_input_poll(w->surface, &event)) {
- if (event.kind == YASL_INPUT_KEY) {
+ while (yasl_surface_poll_event(w->surface, &event)) {
+ if (event.type == YASL_EVENT_KEY) {
assert(event.key.key == YASL_KEY_A && event.key.codepoint == 'q');
saw_key = true;
- } else if (event.kind == YASL_INPUT_TEXT) {
- assert(event.text.len == 1 && event.text.text[0] == 'q');
+ } else if (event.type == YASL_EVENT_TEXT) {
+ assert(event.text.len == 1 && event.text.data[0] == 'q');
saw_text = true;
}
}
@@ -308,11 +308,11 @@ static void x11_behavior(struct yasl_loop *loop, struct yasl_display *d, struct
XSendEvent(native, window, False, NoEventMask, &wheel);
XFlush(native);
pump(loop, d, NULL);
- assert(yasl_surface_input_poll(w->surface, &event));
- assert(event.kind == YASL_INPUT_MOUSE && event.mouse.kind == YASL_PTR_SCROLL);
- assert(event.mouse.scroll.x == (button == 6 ? -1 : button == 7 ? 1 : 0));
- assert(event.mouse.scroll.y == (button == 4 ? -1 : button == 5 ? 1 : 0));
- assert(!yasl_surface_input_poll(w->surface, &event));
+ assert(yasl_surface_poll_event(w->surface, &event));
+ assert(event.type == YASL_EVENT_POINTER_SCROLL);
+ assert(event.pointer.scroll.x == (button == 6 ? -1 : button == 7 ? 1 : 0));
+ assert(event.pointer.scroll.y == (button == 4 ? -1 : button == 5 ? 1 : 0));
+ assert(!yasl_surface_poll_event(w->surface, &event));
}
assert(yasl_surface_timing(w->surface).source == YASL_TIMING_SUBMISSION);
assert(!(yasl_display_caps(d) & YASL_CAP_FRAME_PACING));
@@ -329,18 +329,18 @@ static void x11_behavior(struct yasl_loop *loop, struct yasl_display *d, struct
for (int i = 0; i < 300; i++) {
char text[32];
snprintf(text, sizeof(text), "owned-%d", i);
- assert(yasl_surface_input_poll(w->surface, &event));
- assert(event.kind == YASL_INPUT_PASTE && strcmp(event.paste.text, text) == 0);
+ assert(yasl_surface_poll_event(w->surface, &event));
+ assert(event.type == YASL_EVENT_PASTE && strcmp(event.text.data, text) == 0);
}
- const char *last = event.paste.text;
- assert(!yasl_surface_input_poll(w->surface, &event));
+ const char *last = event.text.data;
+ assert(!yasl_surface_poll_event(w->surface, &event));
yasl_display_copy(d, YASL_CLIPBOARD, "changed");
pump(loop, d, NULL);
assert(strcmp(last, "owned-299") == 0);
yasl_display_copy(d, YASL_CLIPBOARD, "");
yasl_display_paste(d, YASL_CLIPBOARD, w->surface);
- assert(yasl_surface_input_poll(w->surface, &event));
- assert(event.kind == YASL_INPUT_PASTE && !event.paste.len && !event.paste.text[0]);
+ assert(yasl_surface_poll_event(w->surface, &event));
+ assert(event.type == YASL_EVENT_PASTE && !event.text.len && !event.text.data[0]);
/* Concurrent external conversions must not share a mutable target slot. */
struct yasl_display_spec ds = {.backend = YASL_BACKEND_X11};
@@ -354,15 +354,15 @@ static void x11_behavior(struct yasl_loop *loop, struct yasl_display *d, struct
yasl_surface_destroy(cancelled.surface);
pump(loop, d, owner);
int first_pastes = 0, second_pastes = 0;
- while (yasl_surface_input_poll(w->surface, &event)) {
- if (event.kind == YASL_INPUT_PASTE) {
- assert(strcmp(event.paste.text, "external") == 0);
+ while (yasl_surface_poll_event(w->surface, &event)) {
+ if (event.type == YASL_EVENT_PASTE) {
+ assert(strcmp(event.text.data, "external") == 0);
first_pastes++;
}
}
- while (yasl_surface_input_poll(other.surface, &event)) {
- if (event.kind == YASL_INPUT_PASTE) {
- assert(strcmp(event.paste.text, "external") == 0);
+ while (yasl_surface_poll_event(other.surface, &event)) {
+ if (event.type == YASL_EVENT_PASTE) {
+ assert(strcmp(event.text.data, "external") == 0);
second_pastes++;
}
}
diff --git a/tests/common/test_contracts.c b/tests/common/test_contracts.c
index ee6fe61..7c1ab06 100644
--- a/tests/common/test_contracts.c
+++ b/tests/common/test_contracts.c
@@ -37,31 +37,27 @@ static void test_queue(void)
{
struct input_queue q = {0};
struct yasl_surface surface = {0};
- const enum yasl_input_kind kinds[] = {
- YASL_INPUT_TEXT, YASL_INPUT_PASTE, YASL_INPUT_DROP_FILES,
+ const enum yasl_event_type kinds[] = {
+ YASL_EVENT_TEXT, YASL_EVENT_PASTE, YASL_EVENT_DROP,
};
for (size_t k = 0; k < sizeof(kinds) / sizeof(kinds[0]); k++) {
char *source = malloc(4);
assert(source);
memcpy(source, "a\0b", 4);
- struct yasl_input_event in = {.surface = &surface, .kind = kinds[k]};
- if (in.kind == YASL_INPUT_TEXT) { in.text.text = source; in.text.len = 3; }
- if (in.kind == YASL_INPUT_PASTE) { in.paste.text = source; in.paste.len = 3; }
- if (in.kind == YASL_INPUT_DROP_FILES) { in.drop_files.files = source; in.drop_files.len = 3; }
+ struct yasl_event in = {.surface = &surface, .type = kinds[k], .text = {.data = source, .len = 3}};
assert(input_queue_push(&q, &in));
memset(source, 'x', 4);
free(source);
- struct yasl_input_event out;
+ struct yasl_event out;
assert(input_queue_pop(&q, &out));
- const char *payload = out.kind == YASL_INPUT_TEXT ? out.text.text :
- out.kind == YASL_INPUT_PASTE ? out.paste.text : out.drop_files.files;
- assert(out.surface == &surface && out.kind == kinds[k]);
+ const char *payload = out.text.data;
+ assert(out.surface == &surface && out.type == kinds[k]);
assert(memcmp(payload, "a\0b", 4) == 0);
assert(!input_queue_pop(&q, &out));
assert(memcmp(payload, "a\0b", 4) == 0);
/* Growth/wraparound must not invalidate a previously polled payload. */
for (unsigned i = 0; i < 4096; i++) {
- in = (struct yasl_input_event){.kind = YASL_INPUT_KEY, .key.key = i};
+ in = (struct yasl_event){.type = YASL_EVENT_KEY, .key.key = i};
assert(input_queue_push(&q, &in));
}
assert(memcmp(payload, "a\0b", 4) == 0);
@@ -79,28 +75,28 @@ static void test_queue(void)
}
assert(!input_queue_pop(&q, &out));
}
- struct yasl_input_event empty = {.surface = &surface, .kind = YASL_INPUT_PASTE};
- struct yasl_input_event out;
+ struct yasl_event empty = {.surface = &surface, .type = YASL_EVENT_PASTE};
+ struct yasl_event out;
assert(input_queue_push(&q, &empty));
assert(input_queue_pop(&q, &out));
- assert(out.paste.text && !out.paste.len && out.paste.text[0] == '\0');
- struct yasl_input_event in = {.surface = &surface, .kind = YASL_INPUT_TEXT,
+ assert(out.text.data && !out.text.len && out.text.data[0] == '\0');
+ struct yasl_event in = {.surface = &surface, .type = YASL_EVENT_TEXT,
.text = {"owned", 5}};
assert(input_queue_push(&q, &in));
assert(input_queue_pop(&q, &out));
- const char *last = out.text.text;
+ const char *last = out.text.data;
assert(input_queue_push(&q, &in));
/* Exercise the allocation-failure reset path without allocating huge RAM. */
in.text.len = SIZE_MAX;
assert(!input_queue_push(&q, &in));
assert(strcmp(last, "owned") == 0);
- in = (struct yasl_input_event){.surface = &surface, .kind = YASL_INPUT_KEY};
+ in = (struct yasl_event){.surface = &surface, .type = YASL_EVENT_KEY};
assert(input_queue_push(&q, &in));
- assert(input_queue_pop(&q, &out) && out.kind == YASL_INPUT_RESET);
+ assert(input_queue_pop(&q, &out) && out.type == YASL_EVENT_INPUT_RESET);
assert(out.surface == &surface);
- assert(input_queue_pop(&q, &out) && out.kind == YASL_INPUT_KEY);
+ assert(input_queue_pop(&q, &out) && out.type == YASL_EVENT_KEY);
assert(!input_queue_pop(&q, &out));
- in = (struct yasl_input_event){.kind = YASL_INPUT_PASTE, .paste = {"pending", 7}};
+ in = (struct yasl_event){.type = YASL_EVENT_PASTE, .text = {"pending", 7}};
assert(input_queue_push(&q, &in));
input_queue_clear(&q);
input_queue_clear(&q);
diff --git a/tests/common/test_input_alloc.c b/tests/common/test_input_alloc.c
index e311dc0..b999a62 100644
--- a/tests/common/test_input_alloc.c
+++ b/tests/common/test_input_alloc.c
@@ -12,17 +12,20 @@ void *yasl_test_malloc(size_t bytes)
return calloc(1, bytes);
}
+/* input.c timestamps events, but this executable links no event loop. */
+uint64_t yasl_loop_now_ns(void) { return 1; }
+
int main(void)
{
struct yasl_surface *surface = (struct yasl_surface *)(uintptr_t)1;
for (int failure = 0; failure < 2; failure++) {
struct input_queue q = {0};
- struct yasl_input_event in = {.surface = surface, .kind = YASL_INPUT_PASTE,
- .paste = {"payload", 7}}, out;
+ struct yasl_event in = {.surface = surface, .type = YASL_EVENT_PASTE,
+ .text = {"payload", 7}}, out;
/* Fail either payload allocation or the initial event-array allocation. */
allocations = failure;
assert(!input_queue_push(&q, &in));
- assert(input_queue_pop(&q, &out) && out.kind == YASL_INPUT_RESET);
+ assert(input_queue_pop(&q, &out) && out.type == YASL_EVENT_INPUT_RESET);
assert(out.surface == surface);
assert(!input_queue_pop(&q, &out));
input_queue_clear(&q);
@@ -30,17 +33,17 @@ int main(void)
allocations = -1;
assert(input_queue_push(&q, &in));
assert(input_queue_pop(&q, &out));
- const char *last = out.paste.text;
+ const char *last = out.text.data;
for (size_t i = 0; i < q.capacity; i++) assert(input_queue_push(&q, &in));
allocations = failure;
assert(!input_queue_push(&q, &in));
assert(strcmp(last, "payload") == 0);
assert(!q.count && q.reset_pending);
allocations = -1;
- in = (struct yasl_input_event){.surface = surface, .kind = YASL_INPUT_KEY,
+ in = (struct yasl_event){.surface = surface, .type = YASL_EVENT_KEY,
.key.action = YASL_KEY_RELEASE};
assert(input_queue_push(&q, &in));
- assert(input_queue_pop(&q, &out) && out.kind == YASL_INPUT_RESET);
+ assert(input_queue_pop(&q, &out) && out.type == YASL_EVENT_INPUT_RESET);
assert(input_queue_pop(&q, &out) && out.key.action == YASL_KEY_RELEASE);
input_queue_clear(&q);
}
diff --git a/tests/common/test_tablet_example.c b/tests/common/test_tablet_example.c
index 77e79f6..e291b2a 100644
--- a/tests/common/test_tablet_example.c
+++ b/tests/common/test_tablet_example.c
@@ -3,23 +3,18 @@
#undef main
#include <assert.h>
-static void pointer(struct app *app, enum yasl_pointer_kind kind,
- enum yasl_pointer_device device, int button, int x, int y, uint16_t pressure)
+static void pointer(struct app *app, enum yasl_event_type type,
+ enum yasl_pointer_device device, enum yasl_pointer_button button, int x, int y, uint16_t pressure)
{
- struct yasl_event event = {0};
- if (kind == YASL_PTR_MOTION) {
- event.type = YASL_EVENT_MOUSE_MOTION;
- event.mouse_motion.pos = (struct yasl_vector2i){x, y};
- event.mouse_motion.device = device;
- event.mouse_motion.pen.pressure = pressure;
- } else {
- event.type = YASL_EVENT_MOUSE_BUTTON;
- event.mouse_button.pos = (struct yasl_vector2i){x, y};
- event.mouse_button.device = device;
- event.mouse_button.button = button;
- event.mouse_button.pressed = kind == YASL_PTR_PRESS;
- event.mouse_button.pen.pressure = pressure;
- }
+ struct yasl_event event = {
+ .type = type,
+ .pointer = {
+ .pos = (struct yasl_vector2i){x, y},
+ .device = device,
+ .button = button,
+ .pen = { .pressure = pressure },
+ },
+ };
input(app, &event);
}
@@ -27,36 +22,36 @@ int main(void)
{
struct app app = {0};
assert(resize_canvas(&app, (struct yasl_geometry){{400, 300}, 120}));
- pointer(&app, YASL_PTR_MOTION, YASL_PTR_DEV_PEN, 3, 80, 160, 65535);
+ pointer(&app, YASL_EVENT_POINTER_MOTION, YASL_PTR_DEV_PEN, YASL_BUTTON_BACK, 80, 160, 65535);
/* Hover never paints. */
assert(app.canvas[(size_t)160 * app.geometry.size.x + 80] == PAPER);
- pointer(&app, YASL_PTR_PRESS, YASL_PTR_DEV_PEN, 2, 80, 160, 65535);
+ pointer(&app, YASL_EVENT_POINTER_DOWN, YASL_PTR_DEV_PEN, YASL_BUTTON_SECONDARY, 80, 160, 65535);
/* Side button isn't the tip. */
assert(!app.down &&
app.canvas[(size_t)160 * app.geometry.size.x + 80] == PAPER);
- pointer(&app, YASL_PTR_PRESS, YASL_PTR_DEV_PEN, 0, 80, 160, 0);
+ pointer(&app, YASL_EVENT_POINTER_DOWN, YASL_PTR_DEV_PEN, YASL_BUTTON_PRIMARY, 80, 160, 0);
assert(app.down &&
app.canvas[(size_t)160 * app.geometry.size.x + 80] == INK &&
app.canvas[(size_t)160 * app.geometry.size.x + 90] == PAPER);
- pointer(&app, YASL_PTR_MOTION, YASL_PTR_DEV_PEN, 0, 80, 160, 65535);
+ pointer(&app, YASL_EVENT_POINTER_MOTION, YASL_PTR_DEV_PEN, YASL_BUTTON_PRIMARY, 80, 160, 65535);
/* Stationary pressure widens brush. */
assert(app.canvas[(size_t)160 * app.geometry.size.x + 100] == INK);
- pointer(&app, YASL_PTR_MOTION, YASL_PTR_DEV_PEN, 0, 180, 160, 20000);
+ pointer(&app, YASL_EVENT_POINTER_MOTION, YASL_PTR_DEV_PEN, YASL_BUTTON_PRIMARY, 180, 160, 20000);
/* Segments are continuous. */
assert(app.canvas[(size_t)160 * app.geometry.size.x + 130] == INK);
- pointer(&app, YASL_PTR_RELEASE, YASL_PTR_DEV_PEN, 0, 180, 160, 0);
- pointer(&app, YASL_PTR_MOTION, YASL_PTR_DEV_PEN, 3, 250, 160, 65535);
+ pointer(&app, YASL_EVENT_POINTER_UP, YASL_PTR_DEV_PEN, YASL_BUTTON_PRIMARY, 180, 160, 0);
+ pointer(&app, YASL_EVENT_POINTER_MOTION, YASL_PTR_DEV_PEN, YASL_BUTTON_BACK, 250, 160, 65535);
assert(!app.down && app.canvas[(size_t)160 * app.geometry.size.x + 250] == PAPER);
- pointer(&app, YASL_PTR_PRESS, YASL_PTR_DEV_ERASER, 0, 80, 160, 65535);
+ pointer(&app, YASL_EVENT_POINTER_DOWN, YASL_PTR_DEV_ERASER, YASL_BUTTON_PRIMARY, 80, 160, 65535);
assert(app.canvas[(size_t)160 * app.geometry.size.x + 80] == PAPER &&
app.canvas[(size_t)160 * app.geometry.size.x + 130] == INK);
struct yasl_event reset = {.type = YASL_EVENT_INPUT_RESET};
input(&app, &reset);
- pointer(&app, YASL_PTR_MOTION, YASL_PTR_DEV_ERASER, 0, 130, 160, 65535);
+ pointer(&app, YASL_EVENT_POINTER_MOTION, YASL_PTR_DEV_ERASER, YASL_BUTTON_PRIMARY, 130, 160, 65535);
assert(!app.down && app.canvas[(size_t)160 * app.geometry.size.x + 130] == INK);
- pointer(&app, YASL_PTR_PRESS, YASL_PTR_DEV_MOUSE, 0, 300, 200, 0);
+ pointer(&app, YASL_EVENT_POINTER_DOWN, YASL_PTR_DEV_MOUSE, YASL_BUTTON_PRIMARY, 300, 200, 0);
assert(app.canvas[(size_t)200 * app.geometry.size.x + 300] == INK);
- struct yasl_event blur = {.type = YASL_EVENT_WINDOW_FOCUS, .focus.focused = false};
+ struct yasl_event blur = {.type = YASL_EVENT_FOCUS, .focus.focused = false};
input(&app, &blur);
assert(!app.down);
assert(resize_canvas(&app, (struct yasl_geometry){{800, 600}, 240}));