diff options
Diffstat (limited to 'tests/common/test_app.c')
| -rw-r--r-- | tests/common/test_app.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/common/test_app.c b/tests/common/test_app.c index 6972921..f61a957 100644 --- a/tests/common/test_app.c +++ b/tests/common/test_app.c @@ -109,6 +109,29 @@ static void on_quit(void *ud, struct yasl_display *d) state->quit_called = true; } +static void present_once(void *ud, struct yasl_surface *s, struct yasl_frame_context *ctx) +{ + (*(int *)ud)++; + if (ctx->cpu.pixels) + assert(yasl_frame_present_cpu(ctx, NULL, 0)); + yasl_surface_destroy(s); +} + +/* desc.window replaces init: the runner creates the toplevel and draws it. */ +static void test_window_without_init(void) +{ + int frames = 0; + struct yasl_window_spec window = {.title = "App Runner Window", .size = {160, 120}}; + int res = yasl_run(&(struct yasl_app_desc){ + .app_id = "org.yasl.test.app.window", + .userdata = &frames, + .window = &window, + .frame = present_once, + }); + assert(res == 0); + assert(frames == 1); +} + int main(void) { struct test_state state = {0}; @@ -129,6 +152,7 @@ int main(void) assert(state.user_event_called); assert(state.timer_called); assert(state.quit_called); + test_window_without_init(); printf("App runner tests passed!\n"); return 0; } |
