diff options
| author | Berke Güzel <wenekar1@gmail.com> | 2026-10-12 00:09:38 +0300 |
|---|---|---|
| committer | Berke Güzel <wenekar1@gmail.com> | 2026-10-12 00:09:38 +0300 |
| commit | 624d1371304a5ae4b3429ad5e4267aac7cd03dfd (patch) | |
| tree | 32de069f6eec83686521fc4bf39cc9874b123e93 /tests/cocoa/test_native.c | |
| parent | e813252e685d761235ad45e170d97c9375f51958 (diff) | |
missing impls and hardening
Diffstat (limited to 'tests/cocoa/test_native.c')
| -rw-r--r-- | tests/cocoa/test_native.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/tests/cocoa/test_native.c b/tests/cocoa/test_native.c index 03fde88..41df79a 100644 --- a/tests/cocoa/test_native.c +++ b/tests/cocoa/test_native.c @@ -19,7 +19,16 @@ static void draw(struct yasl_surface *surface, struct yasl_frame *frame, void *u struct yasl_vector2i size = yasl_surface_size(surface); assert(size.x == frame->target.size.x && size.y == frame->target.size.y); for (int i = 0; i < size.x * size.y; i++) frame->target.pixels[i] = 0xff4080c0; - struct yasl_damage_list damage = {.n = -1}; + struct yasl_damage_list damage = {.n = YASL_DAMAGE_MAX + 1}; + assert(!yasl_surface_present(surface, &frame->target, &damage)); + damage.n = -1; + struct yasl_framebuffer invalid = frame->target; + invalid.buffer++; + assert(!yasl_surface_present(surface, &invalid, &damage)); + invalid = frame->target; + invalid.generation--; + assert(!yasl_surface_present(surface, &invalid, &damage)); + assert(!yasl_surface_present(surface, &frame->target, NULL)); assert(yasl_surface_present(surface, &frame->target, &damage)); assert(!yasl_surface_present(surface, &frame->target, &damage)); state->draws++; @@ -36,8 +45,9 @@ static void test_window(enum yasl_backend request, bool null_spec) struct yasl_surface_spec surface = {.title = "Native backend test", .size = {160, 100}}; state.surface = yasl_surface_create_toplevel(state.display, &surface); assert(state.surface); - static const struct yasl_surface_cbs callbacks = {.draw = draw}; + struct yasl_surface_cbs callbacks = {.draw = draw}; yasl_surface_set_callbacks(state.surface, &callbacks, &state); + callbacks.draw = NULL; yasl_surface_schedule_redraw(state.surface); uint64_t deadline = yasl_loop_now_ns() + 3000000000ull; while (!state.draws && yasl_loop_now_ns() < deadline) { |
