summaryrefslogtreecommitdiff
path: root/tests/common/test_hello_example.c
blob: 6e0318f1660dbba58d92f6c5241a563746ad5d99 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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;
}