diff options
Diffstat (limited to 'tests/common/test_hello_example.c')
| -rw-r--r-- | tests/common/test_hello_example.c | 20 |
1 files changed, 20 insertions, 0 deletions
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; +} |
