aboutsummaryrefslogtreecommitdiffstats
path: root/test/pugl_test.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2019-11-03 21:13:40 +0100
committerDavid Robillard <d@drobilla.net>2019-11-09 12:15:17 +0100
commitb5f04656a4b3d1b43a66585ead8ef55536a4fdbc (patch)
treeefc8765b6e7a5c670735205593a7daed38bce83b /test/pugl_test.c
parentbe838db18af13390cb9f705d36ab83396d2dd1e6 (diff)
downloadpugl-b5f04656a4b3d1b43a66585ead8ef55536a4fdbc.tar.gz
pugl-b5f04656a4b3d1b43a66585ead8ef55536a4fdbc.tar.bz2
pugl-b5f04656a4b3d1b43a66585ead8ef55536a4fdbc.zip
Add puglStrerror() and improve test program error reporting
Diffstat (limited to 'test/pugl_test.c')
-rw-r--r--test/pugl_test.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/test/pugl_test.c b/test/pugl_test.c
index 7033d45..6558bf6 100644
--- a/test/pugl_test.c
+++ b/test/pugl_test.c
@@ -323,10 +323,12 @@ main(int argc, char** argv)
puglSetHandle(app.parent, &app);
puglSetEventFunc(app.parent, onParentEvent);
+ PuglStatus st = PUGL_SUCCESS;
const uint8_t title[] = { 'P', 'u', 'g', 'l', ' ',
'P', 'r', 0xC3, 0xBC, 'f', 'u', 'n', 'g', 0 };
- if (puglCreateWindow(app.parent, (const char*)title)) {
- fprintf(stderr, "error: Failed to create parent window\n");
+ if ((st = puglCreateWindow(app.parent, (const char*)title))) {
+ fprintf(stderr, "error: Failed to create parent window (%s)\n",
+ puglStrerror(st));
return 1;
}
@@ -341,9 +343,9 @@ main(int argc, char** argv)
puglSetHandle(app.child, &app);
puglSetEventFunc(app.child, onEvent);
- const int st = puglCreateWindow(app.child, NULL);
- if (st) {
- fprintf(stderr, "error: Failed to create child window (%d)\n", st);
+ if ((st = puglCreateWindow(app.child, NULL))) {
+ fprintf(stderr, "error: Failed to create child window (%s)\n",
+ puglStrerror(st));
return 1;
}