summaryrefslogtreecommitdiff
path: root/tests/test_lifecycle.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_lifecycle.c')
-rw-r--r--tests/test_lifecycle.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/test_lifecycle.c b/tests/test_lifecycle.c
index 41dafe6..7ba3f89 100644
--- a/tests/test_lifecycle.c
+++ b/tests/test_lifecycle.c
@@ -1,6 +1,11 @@
#include <yasl/yasl.h>
#include <assert.h>
#include <string.h>
+static void on_event(void *userdata, const yasl_event *event)
+{
+ (void)userdata;
+ (void)event;
+}
int main(void)
{
assert(yasl_shutdown() == 0);
@@ -8,7 +13,14 @@ int main(void)
yasl_event event = {.type = YASL_EVENT_QUIT};
assert(yasl_wait_event(&event, 0) == -ENODEV && event.type == YASL_EVENT_NONE);
assert(yasl_wait_event(NULL, 0) == -EINVAL);
- assert(yasl_init((enum yasl_backend)999, NULL) == -EINVAL);
+ assert(yasl_init(&(struct yasl_options){.backend = (enum yasl_backend)999}) == -EINVAL);
+ /* The loop and its event callback come together or not at all. */
+ yasl_loop *loop = yasl_loop_create();
+ assert(loop);
+ assert(yasl_init(&(struct yasl_options){.loop = loop}) == -EINVAL);
+ assert(yasl_init(&(struct yasl_options){.on_event = on_event}) == -EINVAL);
+ assert(yasl_loop_destroy(loop) == 0);
+ assert(yasl_surface_request_frame(NULL) == -ENODEV);
assert(yasl_get_backend() == YASL_BACKEND_AUTO && yasl_get_features() == 0);
assert(!yasl_surface_create(NULL) && errno == EINVAL);
struct yasl_surface_options options = {.width = 0, .height = 64};