aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2022-05-20 14:23:41 -0400
committerDavid Robillard <d@drobilla.net>2022-05-21 16:49:47 -0400
commit1cd37cad0a06fbb15c44fd59dd6b2c12a0812a76 (patch)
treed7760c11195b003dc27a6f86f0c47df51c0a32da /test
parent0fc1422e858bf9849b84aee2abeca3b553214b73 (diff)
downloadpugl-1cd37cad0a06fbb15c44fd59dd6b2c12a0812a76.tar.gz
pugl-1cd37cad0a06fbb15c44fd59dd6b2c12a0812a76.tar.bz2
pugl-1cd37cad0a06fbb15c44fd59dd6b2c12a0812a76.zip
Add a uniform API for setting size hints
This collapses many functions into one, which makes the API more easily extensible and reduces code size.
Diffstat (limited to 'test')
-rw-r--r--test/test_cairo.c2
-rw-r--r--test/test_gl.c2
-rw-r--r--test/test_gl_free_unrealized.c2
-rw-r--r--test/test_gl_hints.c2
-rw-r--r--test/test_local_copy_paste.c2
-rw-r--r--test/test_realize.c2
-rw-r--r--test/test_redisplay.c2
-rw-r--r--test/test_remote_copy_paste.c4
-rw-r--r--test/test_show_hide.c2
-rw-r--r--test/test_size.c15
-rw-r--r--test/test_stub.c2
-rw-r--r--test/test_stub_hints.c2
-rw-r--r--test/test_timer.c2
-rw-r--r--test/test_update.c2
-rw-r--r--test/test_view.c2
-rw-r--r--test/test_vulkan.c2
16 files changed, 24 insertions, 23 deletions
diff --git a/test/test_cairo.c b/test/test_cairo.c
index 5d2aab8..a9a36db 100644
--- a/test/test_cairo.c
+++ b/test/test_cairo.c
@@ -65,7 +65,7 @@ main(int argc, char** argv)
puglSetHandle(test.view, &test);
puglSetBackend(test.view, puglCairoBackend());
puglSetEventFunc(test.view, onEvent);
- puglSetDefaultSize(test.view, 512, 512);
+ puglSetSizeHint(test.view, PUGL_DEFAULT_SIZE, 512, 512);
puglShow(test.view);
// Drive event loop until the view gets exposed
diff --git a/test/test_gl.c b/test/test_gl.c
index 3fe546b..da84c1a 100644
--- a/test/test_gl.c
+++ b/test/test_gl.c
@@ -84,7 +84,7 @@ main(int argc, char** argv)
puglSetHandle(test.view, &test);
puglSetBackend(test.view, puglGlBackend());
puglSetEventFunc(test.view, onEvent);
- puglSetDefaultSize(test.view, 512, 512);
+ puglSetSizeHint(test.view, PUGL_DEFAULT_SIZE, 512, 512);
puglShow(test.view);
// Enter OpenGL context as if setting things up
diff --git a/test/test_gl_free_unrealized.c b/test/test_gl_free_unrealized.c
index 783ffb8..04a23db 100644
--- a/test/test_gl_free_unrealized.c
+++ b/test/test_gl_free_unrealized.c
@@ -49,7 +49,7 @@ main(int argc, char** argv)
puglSetBackend(test.view, puglGlBackend());
puglSetHandle(test.view, &test);
puglSetEventFunc(test.view, onEvent);
- puglSetDefaultSize(test.view, 512, 512);
+ puglSetSizeHint(test.view, PUGL_DEFAULT_SIZE, 512, 512);
assert(!puglGetVisible(test.view));
diff --git a/test/test_gl_hints.c b/test/test_gl_hints.c
index 701dd77..7e91035 100644
--- a/test/test_gl_hints.c
+++ b/test/test_gl_hints.c
@@ -34,7 +34,7 @@ main(void)
puglSetWindowTitle(view, "Pugl OpenGL Hints Test");
puglSetBackend(view, puglGlBackend());
puglSetEventFunc(view, onEvent);
- puglSetDefaultSize(view, 512, 512);
+ puglSetSizeHint(view, PUGL_DEFAULT_SIZE, 512, 512);
// Check invalid cases
assert(puglSetViewHint(view, PUGL_USE_COMPAT_PROFILE, PUGL_DONT_CARE) ==
diff --git a/test/test_local_copy_paste.c b/test/test_local_copy_paste.c
index a4350f0..f5c75c4 100644
--- a/test/test_local_copy_paste.c
+++ b/test/test_local_copy_paste.c
@@ -94,7 +94,7 @@ main(int argc, char** argv)
puglSetBackend(app.view, puglStubBackend());
puglSetHandle(app.view, &app);
puglSetEventFunc(app.view, onEvent);
- puglSetDefaultSize(app.view, 512, 512);
+ puglSetSizeHint(app.view, PUGL_DEFAULT_SIZE, 512, 512);
// Create and show window
assert(!puglRealize(app.view));
diff --git a/test/test_realize.c b/test/test_realize.c
index d26d866..50eba46 100644
--- a/test/test_realize.c
+++ b/test/test_realize.c
@@ -68,7 +68,7 @@ main(int argc, char** argv)
puglSetBackend(test.view, puglStubBackend());
puglSetHandle(test.view, &test);
puglSetEventFunc(test.view, onEvent);
- puglSetDefaultSize(test.view, 512, 512);
+ puglSetSizeHint(test.view, PUGL_DEFAULT_SIZE, 512, 512);
// Create initially invisible window
assert(!puglRealize(test.view));
diff --git a/test/test_redisplay.c b/test/test_redisplay.c
index 801393e..afe89dc 100644
--- a/test/test_redisplay.c
+++ b/test/test_redisplay.c
@@ -113,7 +113,7 @@ main(int argc, char** argv)
puglSetBackend(test.view, puglStubBackend());
puglSetHandle(test.view, &test);
puglSetEventFunc(test.view, onEvent);
- puglSetDefaultSize(test.view, 512, 512);
+ puglSetSizeHint(test.view, PUGL_DEFAULT_SIZE, 512, 512);
// Create and show window
assert(!puglRealize(test.view));
diff --git a/test/test_remote_copy_paste.c b/test/test_remote_copy_paste.c
index aeba3dc..2ee90f7 100644
--- a/test/test_remote_copy_paste.c
+++ b/test/test_remote_copy_paste.c
@@ -131,7 +131,7 @@ main(int argc, char** argv)
puglSetBackend(app.copierView, puglStubBackend());
puglSetHandle(app.copierView, &app);
puglSetEventFunc(app.copierView, onCopierEvent);
- puglSetDefaultSize(app.copierView, 256, 256);
+ puglSetSizeHint(app.copierView, PUGL_DEFAULT_SIZE, 256, 256);
// Set up paster view
app.pasterView = puglNewView(app.world);
@@ -140,7 +140,7 @@ main(int argc, char** argv)
puglSetBackend(app.pasterView, puglStubBackend());
puglSetHandle(app.pasterView, &app);
puglSetEventFunc(app.pasterView, onPasterEvent);
- puglSetDefaultSize(app.pasterView, 256, 256);
+ puglSetSizeHint(app.pasterView, PUGL_DEFAULT_SIZE, 256, 256);
// Create and show both views
assert(!puglShow(app.copierView));
diff --git a/test/test_show_hide.c b/test/test_show_hide.c
index 32efe19..bfcb035 100644
--- a/test/test_show_hide.c
+++ b/test/test_show_hide.c
@@ -103,7 +103,7 @@ main(int argc, char** argv)
puglSetBackend(test.view, puglStubBackend());
puglSetHandle(test.view, &test);
puglSetEventFunc(test.view, onEvent);
- puglSetDefaultSize(test.view, 512, 512);
+ puglSetSizeHint(test.view, PUGL_DEFAULT_SIZE, 512, 512);
// Create initially invisible window
assert(!puglRealize(test.view));
diff --git a/test/test_size.c b/test/test_size.c
index 862eba5..048bfa5 100644
--- a/test/test_size.c
+++ b/test/test_size.c
@@ -69,9 +69,9 @@ onEvent(PuglView* view, const PuglEvent* event)
int
main(int argc, char** argv)
{
- static const int minSize = 256;
- static const int defaultSize = 512;
- static const int maxSize = 1024;
+ static const PuglSpan minSize = 256;
+ static const PuglSpan defaultSize = 512;
+ static const PuglSpan maxSize = 1024;
PuglTest test = {puglNewWorld(PUGL_PROGRAM, 0),
NULL,
@@ -87,10 +87,11 @@ main(int argc, char** argv)
puglSetHandle(test.view, &test);
puglSetEventFunc(test.view, onEvent);
puglSetViewHint(test.view, PUGL_RESIZABLE, PUGL_TRUE);
- puglSetMinSize(test.view, minSize, minSize);
- puglSetDefaultSize(test.view, defaultSize, defaultSize);
- puglSetMaxSize(test.view, maxSize, maxSize);
- puglSetAspectRatio(test.view, 1, 1, 1, 1);
+ 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);
// Create and show window
assert(!puglRealize(test.view));
diff --git a/test/test_stub.c b/test/test_stub.c
index 308aae3..8ab2c15 100644
--- a/test/test_stub.c
+++ b/test/test_stub.c
@@ -51,7 +51,7 @@ main(int argc, char** argv)
puglSetHandle(test.view, &test);
puglSetBackend(test.view, puglStubBackend());
puglSetEventFunc(test.view, onEvent);
- puglSetDefaultSize(test.view, 512, 512);
+ puglSetSizeHint(test.view, PUGL_DEFAULT_SIZE, 512, 512);
puglShow(test.view);
// Drive event loop until the view gets exposed
diff --git a/test/test_stub_hints.c b/test/test_stub_hints.c
index f45bacc..12a848b 100644
--- a/test/test_stub_hints.c
+++ b/test/test_stub_hints.c
@@ -34,7 +34,7 @@ main(void)
puglSetWindowTitle(view, "Pugl Stub Hints Test");
puglSetBackend(view, puglStubBackend());
puglSetEventFunc(view, onEvent);
- puglSetDefaultSize(view, 512, 512);
+ puglSetSizeHint(view, PUGL_DEFAULT_SIZE, 512, 512);
// Check invalid cases
assert(puglSetViewHint(view, (PuglViewHint)9999, 0) == PUGL_BAD_PARAMETER);
diff --git a/test/test_timer.c b/test/test_timer.c
index 70e6e3b..401e4d5 100644
--- a/test/test_timer.c
+++ b/test/test_timer.c
@@ -111,7 +111,7 @@ main(int argc, char** argv)
puglSetBackend(test.view, puglStubBackend());
puglSetHandle(test.view, &test);
puglSetEventFunc(test.view, onEvent);
- puglSetDefaultSize(test.view, 512, 512);
+ puglSetSizeHint(test.view, PUGL_DEFAULT_SIZE, 512, 512);
// Create and show window
assert(!puglRealize(test.view));
diff --git a/test/test_update.c b/test/test_update.c
index 4fb6ac1..381e34b 100644
--- a/test/test_update.c
+++ b/test/test_update.c
@@ -89,7 +89,7 @@ main(int argc, char** argv)
puglSetBackend(test.view, puglStubBackend());
puglSetHandle(test.view, &test);
puglSetEventFunc(test.view, onEvent);
- puglSetDefaultSize(test.view, 512, 512);
+ puglSetSizeHint(test.view, PUGL_DEFAULT_SIZE, 512, 512);
// Create and show window
assert(!puglRealize(test.view));
diff --git a/test/test_view.c b/test/test_view.c
index 04cd2c1..e9a954c 100644
--- a/test/test_view.c
+++ b/test/test_view.c
@@ -70,7 +70,7 @@ main(int argc, char** argv)
puglSetBackend(test.view, puglStubBackend());
puglSetHandle(test.view, &test);
puglSetEventFunc(test.view, onEvent);
- puglSetDefaultSize(test.view, 512, 512);
+ puglSetSizeHint(test.view, PUGL_DEFAULT_SIZE, 512, 512);
// Create and show window
assert(!puglRealize(test.view));
diff --git a/test/test_vulkan.c b/test/test_vulkan.c
index 0a364f3..77921b4 100644
--- a/test/test_vulkan.c
+++ b/test/test_vulkan.c
@@ -171,7 +171,7 @@ main(int argc, char** argv)
puglSetHandle(test.view, &test);
puglSetBackend(test.view, puglVulkanBackend());
puglSetEventFunc(test.view, onEvent);
- puglSetDefaultSize(test.view, 512, 512);
+ puglSetSizeHint(test.view, PUGL_DEFAULT_SIZE, 512, 512);
assert(!puglRealize(test.view));
// Create Vulkan surface for window