diff options
| author | Berke Güzel <wenekar1@gmail.com> | 2026-10-13 15:41:39 +0300 |
|---|---|---|
| committer | Berke Güzel <wenekar1@gmail.com> | 2026-10-13 15:41:39 +0300 |
| commit | 482f799d356a8fbb8f585c4de7cc0992b8dc6fd3 (patch) | |
| tree | 85551a69e3c356da7b9b514224e25a6c2f8d29b9 /tests/common/test_input_alloc.c | |
| parent | 537b2d768b31deb0f95c5122e0d562e4406ae9a0 (diff) | |
Migrate tests to the unified event API
Port backend, input, tablet and app tests from yasl_input_event and
YASL_INPUT_* to struct yasl_event and YASL_EVENT_*. The input allocation
test links input.c on its own, so it stubs yasl_loop_now_ns() for the new
event timestamps.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tests/common/test_input_alloc.c')
| -rw-r--r-- | tests/common/test_input_alloc.c | 15 |
1 files changed, 9 insertions, 6 deletions
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); } |
