aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2022-04-22 17:51:15 -0400
committerDavid Robillard <d@drobilla.net>2022-04-23 21:19:17 -0400
commit68d837a98dd1fb5ff4df28bbda501ab2ad1b4ee8 (patch)
tree42fbc0295427417cef02829399afccbb8fc08e21 /test
parentadc8d07a210adcea86024121b53f28170141dae4 (diff)
downloadpugl-68d837a98dd1fb5ff4df28bbda501ab2ad1b4ee8.tar.gz
pugl-68d837a98dd1fb5ff4df28bbda501ab2ad1b4ee8.tar.bz2
pugl-68d837a98dd1fb5ff4df28bbda501ab2ad1b4ee8.zip
Add descriptive verbose output to test_redisplay
Diffstat (limited to 'test')
-rw-r--r--test/test_redisplay.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/test/test_redisplay.c b/test/test_redisplay.c
index fa0e59f..6f3c9d9 100644
--- a/test/test_redisplay.c
+++ b/test/test_redisplay.c
@@ -17,6 +17,7 @@
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
+#include <stdio.h>
#ifdef __APPLE__
static const double timeout = 1 / 60.0;
@@ -24,13 +25,24 @@ static const double timeout = 1 / 60.0;
static const double timeout = -1.0;
#endif
-typedef enum {
- START,
- EXPOSED,
- SHOULD_REDISPLAY,
- POSTED_REDISPLAY,
- REDISPLAYED,
-} State;
+#define STATES \
+ X(START) \
+ X(EXPOSED) \
+ X(SHOULD_REDISPLAY) \
+ X(POSTED_REDISPLAY) \
+ X(REDISPLAYED)
+
+#define X(state) state,
+
+typedef enum { STATES } State;
+
+#undef X
+
+#define X(state) #state,
+
+static const char* const state_names[] = {STATES};
+
+#undef X
typedef struct {
PuglWorld* world;
@@ -48,7 +60,8 @@ onEvent(PuglView* view, const PuglEvent* event)
PuglTest* test = (PuglTest*)puglGetHandle(view);
if (test->opts.verbose) {
- printEvent(event, "Event: ", true);
+ fprintf(stderr, "%-16s", state_names[test->state]);
+ printEvent(event, " ", true);
}
switch (event->type) {