aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2023-01-07 19:27:18 -0500
committerDavid Robillard <d@drobilla.net>2023-01-07 20:27:35 -0500
commit14b35ef217f5ee387c4f33b1b24bebb015e18f23 (patch)
tree2e9ea2b44dfc9e3108f1a1c489f6842273404272 /test
parent4ad8621ac1d94c8e9cf88f83c46a3a70cd91212b (diff)
downloadpugl-14b35ef217f5ee387c4f33b1b24bebb015e18f23.tar.gz
pugl-14b35ef217f5ee387c4f33b1b24bebb015e18f23.tar.bz2
pugl-14b35ef217f5ee387c4f33b1b24bebb015e18f23.zip
Replace map/unmap events with more expressive configure events
Diffstat (limited to 'test')
-rw-r--r--test/test_show_hide.c15
-rw-r--r--test/test_size.c6
-rw-r--r--test/test_utils.h6
-rw-r--r--test/test_view.c13
4 files changed, 14 insertions, 26 deletions
diff --git a/test/test_show_hide.c b/test/test_show_hide.c
index a5c8622..6664a1e 100644
--- a/test/test_show_hide.c
+++ b/test/test_show_hide.c
@@ -20,7 +20,6 @@
typedef enum {
START,
REALIZED,
- CONFIGURED,
MAPPED,
EXPOSED,
UNMAPPED,
@@ -49,22 +48,16 @@ onEvent(PuglView* view, const PuglEvent* event)
test->state = REALIZED;
break;
case PUGL_CONFIGURE:
- if (test->state == REALIZED) {
- test->state = CONFIGURED;
+ if (event->configure.style & PUGL_VIEW_STYLE_MAPPED) {
+ test->state = MAPPED;
+ } else {
+ test->state = UNMAPPED;
}
break;
- case PUGL_MAP:
- assert(test->state == CONFIGURED || test->state == UNMAPPED);
- test->state = MAPPED;
- break;
case PUGL_EXPOSE:
assert(test->state == MAPPED || test->state == EXPOSED);
test->state = EXPOSED;
break;
- case PUGL_UNMAP:
- assert(test->state == MAPPED || test->state == EXPOSED);
- test->state = UNMAPPED;
- break;
case PUGL_UNREALIZE:
assert(test->state == UNMAPPED);
test->state = UNREALIZED;
diff --git a/test/test_size.c b/test/test_size.c
index ef8b738..f19deb9 100644
--- a/test/test_size.c
+++ b/test/test_size.c
@@ -18,7 +18,6 @@ typedef enum {
START,
REALIZED,
CONFIGURED,
- MAPPED,
UNREALIZED,
} State;
@@ -53,9 +52,6 @@ onEvent(PuglView* view, const PuglEvent* event)
test->configuredFrame.width = event->configure.width;
test->configuredFrame.height = event->configure.height;
break;
- case PUGL_MAP:
- test->state = MAPPED;
- break;
case PUGL_UNREALIZE:
test->state = UNREALIZED;
break;
@@ -96,7 +92,7 @@ main(int argc, char** argv)
// Create and show window
assert(!puglRealize(test.view));
assert(!puglShow(test.view));
- while (test.state < MAPPED) {
+ while (test.state < CONFIGURED) {
assert(!puglUpdate(test.world, -1.0));
}
diff --git a/test/test_utils.h b/test/test_utils.h
index 5655e53..85276fb 100644
--- a/test/test_utils.h
+++ b/test/test_utils.h
@@ -111,6 +111,8 @@ viewStyleFlagString(const PuglViewStyleFlag state)
return "demanding";
case PUGL_VIEW_STYLE_RESIZING:
return "resizing";
+ case PUGL_VIEW_STYLE_MAPPED:
+ return "mapped";
}
return "unknown";
@@ -132,10 +134,6 @@ printEvent(const PuglEvent* event, const char* prefix, const bool verbose)
return fprintf(stderr, "%sRealize\n", prefix);
case PUGL_UNREALIZE:
return fprintf(stderr, "%sUnrealize\n", prefix);
- case PUGL_MAP:
- return fprintf(stderr, "%sMap\n", prefix);
- case PUGL_UNMAP:
- return fprintf(stderr, "%sUnmap\n", prefix);
case PUGL_KEY_PRESS:
return PRINT("%sKey press code %3u key U+%04X\n",
prefix,
diff --git a/test/test_view.c b/test/test_view.c
index 34bf124..eeedc96 100644
--- a/test/test_view.c
+++ b/test/test_view.c
@@ -16,8 +16,8 @@
typedef enum {
START,
- CREATED,
- MAPPED,
+ REALIZED,
+ CONFIGURED,
UNREALIZED,
} State;
@@ -40,10 +40,11 @@ onEvent(PuglView* view, const PuglEvent* event)
switch (event->type) {
case PUGL_REALIZE:
assert(test->state == START);
- test->state = CREATED;
+ test->state = REALIZED;
break;
- case PUGL_MAP:
- test->state = MAPPED;
+ case PUGL_CONFIGURE:
+ assert(test->state == REALIZED);
+ test->state = CONFIGURED;
break;
case PUGL_UNREALIZE:
test->state = UNREALIZED;
@@ -75,7 +76,7 @@ main(int argc, char** argv)
// Create and show window
assert(!puglRealize(test.view));
assert(!puglShow(test.view));
- while (test.state < MAPPED) {
+ while (test.state < CONFIGURED) {
assert(!puglUpdate(test.world, -1.0));
}