aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_redisplay.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2023-01-11 14:27:29 -0500
committerDavid Robillard <d@drobilla.net>2023-01-11 14:27:29 -0500
commit916f989661fd53f42740a9469c80f6396993741f (patch)
tree266c4f509975f922ad2187fd143af1e748a6e9ef /test/test_redisplay.c
parent1073ef1b714dfffd734898b48da27c9b023d4f89 (diff)
downloadpugl-916f989661fd53f42740a9469c80f6396993741f.tar.gz
pugl-916f989661fd53f42740a9469c80f6396993741f.tar.bz2
pugl-916f989661fd53f42740a9469c80f6396993741f.zip
Test redisplay outside of event handlers
Diffstat (limited to 'test/test_redisplay.c')
-rw-r--r--test/test_redisplay.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/test/test_redisplay.c b/test/test_redisplay.c
index fe3bc6b..60dd219 100644
--- a/test/test_redisplay.c
+++ b/test/test_redisplay.c
@@ -29,7 +29,8 @@ static const double timeout = -1.0;
X(EXPOSED) \
X(SHOULD_REDISPLAY) \
X(POSTED_REDISPLAY) \
- X(REDISPLAYED)
+ X(REDISPLAYED) \
+ X(REREDISPLAYED)
#define X(state) state,
@@ -82,6 +83,8 @@ onEvent(PuglView* view, const PuglEvent* event)
(event->expose.y + event->expose.height >=
redisplayRect.y + redisplayRect.height)) {
test->state = REDISPLAYED;
+ } else if (test->state == REDISPLAYED) {
+ test->state = REREDISPLAYED;
}
break;
@@ -136,6 +139,12 @@ main(int argc, char** argv)
assert(test.state != POSTED_REDISPLAY);
}
+ // Redisplay from outside the event handler
+ puglPostRedisplay(test.view);
+ while (test.state != REREDISPLAYED) {
+ assert(!puglUpdate(test.world, timeout));
+ }
+
// Tear down
puglFreeView(test.view);
puglFreeWorld(test.world);