From 68d837a98dd1fb5ff4df28bbda501ab2ad1b4ee8 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 22 Apr 2022 17:51:15 -0400 Subject: Add descriptive verbose output to test_redisplay --- test/test_redisplay.c | 29 +++++++++++++++++++++-------- 1 file 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 #include #include +#include #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) { -- cgit v1.2.1