From c059e3aa7f93da470f052a5cd8ee0d8dc969e679 Mon Sep 17 00:00:00 2001 From: Berke Güzel Date: Tue, 13 Oct 2026 13:44:13 +0300 Subject: rename and simplification --- tests/cocoa/test_cursor.m | 2 +- tests/cocoa/test_keyboard.m | 2 +- tests/cocoa/test_native.c | 9 ++++++--- tests/cocoa/test_ownership.m | 2 +- tests/cocoa/test_tablet.m | 2 +- 5 files changed, 10 insertions(+), 7 deletions(-) (limited to 'tests/cocoa') diff --git a/tests/cocoa/test_cursor.m b/tests/cocoa/test_cursor.m index 7a328f2..aaca815 100644 --- a/tests/cocoa/test_cursor.m +++ b/tests/cocoa/test_cursor.m @@ -17,7 +17,7 @@ int main(void) @autoreleasepool { struct yasl_display *display = yasl_display_open(NULL, NULL); assert(display); - struct yasl_surface_spec spec = {.title = "Cursor test", .size = {320, 240}}; + struct yasl_window_spec spec = {.title = "Cursor test", .size = {320, 240}}; struct yasl_surface *surface = yasl_surface_create_toplevel(display, &spec); assert(surface); NSWindow *window = (NSWindow *)yasl_surface_get_native_handle(surface); diff --git a/tests/cocoa/test_keyboard.m b/tests/cocoa/test_keyboard.m index 4854065..d6a1336 100644 --- a/tests/cocoa/test_keyboard.m +++ b/tests/cocoa/test_keyboard.m @@ -50,7 +50,7 @@ int main(void) @autoreleasepool { struct yasl_display *display = yasl_display_open(NULL, NULL); assert(display); - struct yasl_surface_spec spec = {.title = "Keyboard test", .size = {320, 240}}; + struct yasl_window_spec spec = {.title = "Keyboard test", .size = {320, 240}}; struct yasl_surface *surface = yasl_surface_create_toplevel(display, &spec); assert(surface); NSWindow *window = (NSWindow *)yasl_surface_get_native_handle(surface); diff --git a/tests/cocoa/test_native.c b/tests/cocoa/test_native.c index 0c101dd..674513d 100644 --- a/tests/cocoa/test_native.c +++ b/tests/cocoa/test_native.c @@ -48,11 +48,14 @@ static void test_window(enum yasl_backend request, bool null_spec) struct state state = {.display = yasl_display_open(NULL, null_spec ? NULL : &spec)}; assert(state.display); assert(yasl_display_backend(state.display) == YASL_BACKEND_COCOA); - struct yasl_surface_spec surface = {.title = "Native backend test", .size = {160, 100}}; + struct yasl_window_cbs callbacks = {.draw = draw}; + struct yasl_window_spec surface = { + .title = "Native backend test", .size = {160, 100}, + .cbs = &callbacks, .ud = &state, + }; state.surface = yasl_surface_create_toplevel(state.display, &surface); assert(state.surface); - struct yasl_surface_cbs callbacks = {.draw = draw}; - yasl_surface_set_callbacks(state.surface, &callbacks, &state); + assert(!state.draws); callbacks.draw = NULL; yasl_surface_schedule_redraw(state.surface); uint64_t deadline = yasl_loop_now_ns() + 3000000000ull; diff --git a/tests/cocoa/test_ownership.m b/tests/cocoa/test_ownership.m index 2b2f52d..4e3bbd6 100644 --- a/tests/cocoa/test_ownership.m +++ b/tests/cocoa/test_ownership.m @@ -10,7 +10,7 @@ int main(void) { struct yasl_display *d = yasl_display_open(NULL, NULL); assert(d); - struct yasl_surface_spec spec = {.title = "Ownership test", .size = {160, 100}}; + struct yasl_window_spec spec = {.title = "Ownership test", .size = {160, 100}}; struct yasl_surface *s = yasl_surface_create_toplevel(d, &spec); assert(s); assert(yasl_display_get_native_handle(d) == (void *)NSApp); diff --git a/tests/cocoa/test_tablet.m b/tests/cocoa/test_tablet.m index f1489a1..ed6dc64 100644 --- a/tests/cocoa/test_tablet.m +++ b/tests/cocoa/test_tablet.m @@ -49,7 +49,7 @@ int main(void) @autoreleasepool { struct yasl_display *display = yasl_display_open(NULL, NULL); assert(display && (yasl_display_caps(display) & YASL_CAP_TABLET)); - struct yasl_surface_spec spec = {.title = "Tablet test", .size = {320, 240}}; + struct yasl_window_spec spec = {.title = "Tablet test", .size = {320, 240}}; struct yasl_surface *surface = yasl_surface_create_toplevel(display, &spec); assert(surface); NSWindow *window = (NSWindow *)yasl_surface_get_native_handle(surface); -- cgit v1.2.3