diff options
author | David Robillard <d@drobilla.net> | 2023-01-04 11:02:32 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2023-01-04 13:28:46 -0500 |
commit | 2e8e543725e7e3b375321b93c0f5a2e684b60911 (patch) | |
tree | 5ed8d077186df5a01c881d764a872f9daaa3060a /test | |
parent | 0da2b2695face3321e0e39c50b47f6156dfed4e2 (diff) | |
download | pugl-2e8e543725e7e3b375321b93c0f5a2e684b60911.tar.gz pugl-2e8e543725e7e3b375321b93c0f5a2e684b60911.tar.bz2 pugl-2e8e543725e7e3b375321b93c0f5a2e684b60911.zip |
Add puglUnrealize()
Diffstat (limited to 'test')
-rw-r--r-- | test/test_show_hide.c | 43 |
1 files changed, 30 insertions, 13 deletions
diff --git a/test/test_show_hide.c b/test/test_show_hide.c index 61f2bc6..1dc17a2 100644 --- a/test/test_show_hide.c +++ b/test/test_show_hide.c @@ -1,4 +1,4 @@ -// Copyright 2020 David Robillard <d@drobilla.net> +// Copyright 2020-2023 David Robillard <d@drobilla.net> // SPDX-License-Identifier: ISC /* @@ -88,6 +88,24 @@ tick(PuglWorld* world) #endif } +static void +showHide(PuglTest* const test) +{ + // Show and hide window a couple of times + for (unsigned i = 0U; i < 2U; ++i) { + assert(!puglShow(test->view)); + while (test->state != EXPOSED) { + tick(test->world); + } + + assert(puglGetVisible(test->view)); + assert(!puglHide(test->view)); + while (test->state != UNMAPPED) { + tick(test->world); + } + } +} + int main(int argc, char** argv) { @@ -113,21 +131,20 @@ main(int argc, char** argv) } // Show and hide window a couple of times - for (unsigned i = 0U; i < 2U; ++i) { - assert(!puglShow(test.view)); - while (test.state != EXPOSED) { - tick(test.world); - } + showHide(&test); - assert(puglGetVisible(test.view)); - assert(!puglHide(test.view)); - while (test.state != UNMAPPED) { - tick(test.world); - } - } + // Unrealize view + assert(!puglGetVisible(test.view)); + assert(!puglUnrealize(test.view)); + assert(test.state == DESTROYED); + + // Realize and show again + test.state = START; + assert(!puglRealize(test.view)); + showHide(&test); + assert(!puglUnrealize(test.view)); // Tear down - assert(!puglGetVisible(test.view)); puglFreeView(test.view); assert(test.state == DESTROYED); puglFreeWorld(test.world); |