diff options
author | David Robillard <d@drobilla.net> | 2023-01-11 14:27:55 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2023-01-11 17:06:13 -0500 |
commit | 5db9735bb07d84e74936c252ca1c62fdeb2dd117 (patch) | |
tree | c8e981e32f6568e9e28575d8cd73b7802a9a6eb2 /test | |
parent | 26d648604c522d89a4e564214924f786b786e29f (diff) | |
download | pugl-5db9735bb07d84e74936c252ca1c62fdeb2dd117.tar.gz pugl-5db9735bb07d84e74936c252ca1c62fdeb2dd117.tar.bz2 pugl-5db9735bb07d84e74936c252ca1c62fdeb2dd117.zip |
Improve test coverage
Diffstat (limited to 'test')
-rw-r--r-- | test/test_realize.c | 4 | ||||
-rw-r--r-- | test/test_show_hide.c | 6 | ||||
-rw-r--r-- | test/test_size.c | 3 | ||||
-rw-r--r-- | test/test_view.c | 6 |
4 files changed, 13 insertions, 6 deletions
diff --git a/test/test_realize.c b/test/test_realize.c index fcf106e..bf55e50 100644 --- a/test/test_realize.c +++ b/test/test_realize.c @@ -66,12 +66,14 @@ main(int argc, char** argv) puglSetClassName(test.world, "PuglTest"); puglSetWindowTitle(test.view, "Pugl Realize Test"); puglSetHandle(test.view, &test); - puglSetEventFunc(test.view, onEvent); assert(puglRealize(test.view) == PUGL_BAD_BACKEND); puglSetBackend(test.view, puglStubBackend()); assert(puglRealize(test.view) == PUGL_BAD_CONFIGURATION); + puglSetEventFunc(test.view, onEvent); + assert(puglRealize(test.view) == PUGL_BAD_CONFIGURATION); + puglSetSizeHint(test.view, PUGL_DEFAULT_SIZE, 256, 256); puglSetPosition(test.view, 640, 128); diff --git a/test/test_show_hide.c b/test/test_show_hide.c index 2709daf..3b0acae 100644 --- a/test/test_show_hide.c +++ b/test/test_show_hide.c @@ -84,9 +84,9 @@ tick(PuglWorld* world) 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, PUGL_SHOW_RAISE)); + // Show and hide window a few times + for (unsigned i = 0U; i < 3U; ++i) { + assert(!puglShow(test->view, (PuglShowCommand)i)); while (test->state != EXPOSED) { tick(test->world); } diff --git a/test/test_size.c b/test/test_size.c index 3c58619..88afa16 100644 --- a/test/test_size.c +++ b/test/test_size.c @@ -86,8 +86,7 @@ main(int argc, char** argv) puglSetSizeHint(test.view, PUGL_DEFAULT_SIZE, defaultSize, defaultSize); puglSetSizeHint(test.view, PUGL_MIN_SIZE, minSize, minSize); puglSetSizeHint(test.view, PUGL_MAX_SIZE, maxSize, maxSize); - puglSetSizeHint(test.view, PUGL_MIN_ASPECT, 1, 1); - puglSetSizeHint(test.view, PUGL_MAX_ASPECT, 1, 1); + puglSetSizeHint(test.view, PUGL_FIXED_ASPECT, 1, 1); puglSetPosition(test.view, 384, 384); // Create and show window diff --git a/test/test_view.c b/test/test_view.c index e329a93..7f1a112 100644 --- a/test/test_view.c +++ b/test/test_view.c @@ -13,6 +13,7 @@ #include <assert.h> #include <stdbool.h> #include <stddef.h> +#include <string.h> typedef enum { START, @@ -74,6 +75,11 @@ main(int argc, char** argv) puglSetSizeHint(test.view, PUGL_DEFAULT_SIZE, 256, 256); puglSetPosition(test.view, 384, 640); + // Check basic accessors + assert(!strcmp(puglGetClassName(test.world), "PuglTest")); + assert(!strcmp(puglGetWindowTitle(test.view), "Pugl View Test")); + assert(puglGetBackend(test.view) == puglStubBackend()); + // Create and show window assert(!puglRealize(test.view)); assert(!puglShow(test.view, PUGL_SHOW_RAISE)); |