summaryrefslogtreecommitdiff
path: root/tests/common/test_hello_example.c
diff options
context:
space:
mode:
authorBerke Güzel <wenekar1@gmail.com>2026-10-13 15:05:06 +0300
committerBerke Güzel <wenekar1@gmail.com>2026-10-13 15:05:06 +0300
commit98f0d51157fa2a2b8ccaae54ed4850a88d223d01 (patch)
tree90b03d0930986620d95eb0f45c07b96e1331783c /tests/common/test_hello_example.c
parent339e1ad7adb8340732ee856d0f6f0d2c7f1455d1 (diff)
Simplify surface state, examples, and library installation
Diffstat (limited to 'tests/common/test_hello_example.c')
-rw-r--r--tests/common/test_hello_example.c20
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;
+}