aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2019-11-18 13:25:38 +0100
committerDavid Robillard <d@drobilla.net>2019-11-18 19:33:16 +0100
commite9ae30eaa96df7deed014bba00bf999d8b43aa8d (patch)
tree80ab413a5211323a09fe4f17e9b6df34921d30fe /test
parent077b31875b5fdd0d6f299c8834b8a626e263c099 (diff)
downloadpugl-e9ae30eaa96df7deed014bba00bf999d8b43aa8d.tar.gz
pugl-e9ae30eaa96df7deed014bba00bf999d8b43aa8d.tar.bz2
pugl-e9ae30eaa96df7deed014bba00bf999d8b43aa8d.zip
Add error checking option to test programs
Diffstat (limited to 'test')
-rw-r--r--test/pugl_gl3_test.c1
-rw-r--r--test/pugl_test.c2
-rw-r--r--test/test_utils.h6
3 files changed, 8 insertions, 1 deletions
diff --git a/test/pugl_gl3_test.c b/test/pugl_gl3_test.c
index 170f969..06e816c 100644
--- a/test/pugl_gl3_test.c
+++ b/test/pugl_gl3_test.c
@@ -302,6 +302,7 @@ main(int argc, char** argv)
puglSetAspectRatio(app.view, 1, 1, 16, 9);
puglSetBackend(app.view, puglGlBackend());
puglSetViewHint(app.view, PUGL_USE_COMPAT_PROFILE, PUGL_FALSE);
+ puglSetViewHint(app.view, PUGL_USE_DEBUG_CONTEXT, app.opts.errorChecking);
puglSetViewHint(app.view, PUGL_CONTEXT_VERSION_MAJOR, 3);
puglSetViewHint(app.view, PUGL_CONTEXT_VERSION_MINOR, 3);
puglSetViewHint(app.view, PUGL_RESIZABLE, app.opts.resizable);
diff --git a/test/pugl_test.c b/test/pugl_test.c
index f895184..c680866 100644
--- a/test/pugl_test.c
+++ b/test/pugl_test.c
@@ -317,6 +317,7 @@ main(int argc, char** argv)
puglSetAspectRatio(app.parent, 1, 1, 16, 9);
puglSetBackend(app.parent, puglGlBackend());
+ puglSetViewHint(app.parent, PUGL_USE_DEBUG_CONTEXT, opts.errorChecking);
puglSetViewHint(app.parent, PUGL_RESIZABLE, opts.resizable);
puglSetViewHint(app.parent, PUGL_SAMPLES, opts.samples);
puglSetViewHint(app.parent, PUGL_DOUBLE_BUFFER, opts.doubleBuffer);
@@ -337,6 +338,7 @@ main(int argc, char** argv)
puglSetFrame(app.child, getChildFrame(parentFrame));
puglSetParentWindow(app.child, puglGetNativeWindow(app.parent));
+ puglSetViewHint(app.child, PUGL_USE_DEBUG_CONTEXT, opts.errorChecking);
puglSetViewHint(app.child, PUGL_SAMPLES, opts.samples);
puglSetViewHint(app.child, PUGL_DOUBLE_BUFFER, opts.doubleBuffer);
puglSetViewHint(app.child, PUGL_SWAP_INTERVAL, 0);
diff --git a/test/test_utils.h b/test/test_utils.h
index b3d6381..f0f0c75 100644
--- a/test/test_utils.h
+++ b/test/test_utils.h
@@ -33,6 +33,7 @@ typedef struct {
bool ignoreKeyRepeat;
bool resizable;
bool verbose;
+ bool errorChecking;
} PuglTestOptions;
typedef float vec4[4];
@@ -248,6 +249,7 @@ puglPrintTestUsage(const char* prog, const char* posHelp)
" -a Enable anti-aliasing\n"
" -c Continuously animate and draw\n"
" -d Enable double-buffering\n"
+ " -e Enable platform error-checking\n"
" -h Display this help\n"
" -i Ignore key repeat\n"
" -v Print verbose output\n"
@@ -258,7 +260,7 @@ puglPrintTestUsage(const char* prog, const char* posHelp)
static inline PuglTestOptions
puglParseTestOptions(int* pargc, char*** pargv)
{
- PuglTestOptions opts = { 0, 0, false, false, false, false, false };
+ PuglTestOptions opts = { 0, 0, false, false, false, false, false, false };
char** const argv = *pargv;
int i = 1;
@@ -269,6 +271,8 @@ puglParseTestOptions(int* pargc, char*** pargv)
opts.continuous = true;
} else if (!strcmp(argv[i], "-d")) {
opts.doubleBuffer = PUGL_TRUE;
+ } else if (!strcmp(argv[i], "-e")) {
+ opts.errorChecking = PUGL_TRUE;
} else if (!strcmp(argv[i], "-h")) {
opts.help = true;
return opts;