aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_size.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_size.c')
-rw-r--r--test/test_size.c41
1 files changed, 22 insertions, 19 deletions
diff --git a/test/test_size.c b/test/test_size.c
index e3f738a..9c9f518 100644
--- a/test/test_size.c
+++ b/test/test_size.c
@@ -5,10 +5,10 @@
#undef NDEBUG
-#include "test_utils.h"
+#include <puglutil/test_utils.h>
-#include "pugl/pugl.h"
-#include "pugl/stub.h"
+#include <pugl/pugl.h>
+#include <pugl/stub.h>
#include <assert.h>
#include <stdbool.h>
@@ -26,7 +26,8 @@ typedef struct {
PuglView* view;
PuglTestOptions opts;
State state;
- PuglRect configuredFrame;
+ PuglPoint configuredPos;
+ PuglArea configuredSize;
} PuglTest;
static PuglStatus
@@ -47,10 +48,10 @@ onEvent(PuglView* view, const PuglEvent* event)
if (test->state == REALIZED) {
test->state = CONFIGURED;
}
- test->configuredFrame.x = event->configure.x;
- test->configuredFrame.y = event->configure.y;
- test->configuredFrame.width = event->configure.width;
- test->configuredFrame.height = event->configure.height;
+ test->configuredPos.x = event->configure.x;
+ test->configuredPos.y = event->configure.y;
+ test->configuredSize.width = event->configure.width;
+ test->configuredSize.height = event->configure.height;
break;
case PUGL_UNREALIZE:
test->state = UNREALIZED;
@@ -73,7 +74,8 @@ main(int argc, char** argv)
NULL,
puglParseTestOptions(&argc, &argv),
START,
- {0, 0, 0U, 0U}};
+ {0, 0},
+ {0U, 0U}};
// Set up view with size bounds and an aspect ratio
test.view = puglNewView(test.world);
@@ -87,7 +89,7 @@ main(int argc, char** argv)
puglSetSizeHint(test.view, PUGL_MIN_SIZE, minSize, minSize);
puglSetSizeHint(test.view, PUGL_MAX_SIZE, maxSize, maxSize);
puglSetSizeHint(test.view, PUGL_FIXED_ASPECT, 1, 1);
- puglSetPosition(test.view, 384, 384);
+ puglSetPositionHint(test.view, PUGL_DEFAULT_POSITION, 384, 384);
// Create and show window
assert(!puglRealize(test.view));
@@ -97,21 +99,22 @@ main(int argc, char** argv)
}
// Check that the frame matches the last configure event
- const PuglRect frame = puglGetFrame(test.view);
- assert(frame.x == test.configuredFrame.x);
- assert(frame.y == test.configuredFrame.y);
- assert(frame.width == test.configuredFrame.width);
- assert(frame.height == test.configuredFrame.height);
+ const PuglPoint pos = puglGetPositionHint(test.view, PUGL_CURRENT_POSITION);
+ const PuglArea size = puglGetSizeHint(test.view, PUGL_CURRENT_SIZE);
+ assert(pos.x == test.configuredPos.x);
+ assert(pos.y == test.configuredPos.y);
+ assert(size.width == test.configuredSize.width);
+ assert(size.height == test.configuredSize.height);
#if defined(_WIN32) || defined(__APPLE__)
/* Some window managers on Linux (particularly tiling ones) just disregard
these hints entirely, so we only check that the size is in bounds on MacOS
and Windows where this is more or less universally supported. */
- assert(frame.width >= minSize);
- assert(frame.height >= minSize);
- assert(frame.width <= maxSize);
- assert(frame.height <= maxSize);
+ assert(size.width >= minSize);
+ assert(size.height >= minSize);
+ assert(size.width <= maxSize);
+ assert(size.height <= maxSize);
#endif
// Tear down