From 98f0d51157fa2a2b8ccaae54ed4850a88d223d01 Mon Sep 17 00:00:00 2001 From: Berke Güzel Date: Tue, 13 Oct 2026 15:05:06 +0300 Subject: Simplify surface state, examples, and library installation --- tests/common/test_hello_example.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 tests/common/test_hello_example.c (limited to 'tests/common/test_hello_example.c') diff --git a/tests/common/test_hello_example.c b/tests/common/test_hello_example.c new file mode 100644 index 0000000..6e0318f --- /dev/null +++ b/tests/common/test_hello_example.c @@ -0,0 +1,20 @@ +/* Exercise hello's real frame callback; automated exit belongs in the test. */ +#define main hello_example_main +#include "../../examples/hello.c" +#undef main + +static void draw_once(void *ud, struct yasl_surface *surface, struct yasl_frame_context *frame) +{ + draw(ud, surface, frame); + if (!((struct app *)ud)->failed) yasl_surface_destroy(surface); +} + +int main(void) +{ + struct app app = {0}; + struct yasl_app_desc desc = { + .app_id = "org.yasl.test.hello", .userdata = &app, + .init = init, .event = event, .frame = draw_once, + }; + return yasl_run(&desc) || app.failed ? 1 : 0; +} -- cgit v1.2.3