From 44645c11c085dfe115a59c9ef8cbd57f938596dc Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 24 May 2021 16:14:30 -0400 Subject: Test invalid hint cases --- test/test_gl_hints.c | 12 ++++++++++++ test/test_stub_hints.c | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/test/test_gl_hints.c b/test/test_gl_hints.c index d99a57f..6fce42c 100644 --- a/test/test_gl_hints.c +++ b/test/test_gl_hints.c @@ -49,6 +49,18 @@ main(void) puglSetEventFunc(view, onEvent); puglSetDefaultSize(view, 512, 512); + // Check invalid cases + assert(puglSetViewHint(view, PUGL_USE_COMPAT_PROFILE, PUGL_DONT_CARE) == + PUGL_BAD_PARAMETER); + assert(puglSetViewHint(view, PUGL_USE_DEBUG_CONTEXT, PUGL_DONT_CARE) == + PUGL_BAD_PARAMETER); + assert(puglSetViewHint(view, PUGL_CONTEXT_VERSION_MAJOR, PUGL_DONT_CARE) == + PUGL_BAD_PARAMETER); + assert(puglSetViewHint(view, PUGL_CONTEXT_VERSION_MINOR, PUGL_DONT_CARE) == + PUGL_BAD_PARAMETER); + assert(puglSetViewHint(view, PUGL_SWAP_INTERVAL, PUGL_DONT_CARE) == + PUGL_BAD_PARAMETER); + // Set all hints that support it to PUGL_DONT_CARE assert(!puglSetViewHint(view, PUGL_RED_BITS, PUGL_DONT_CARE)); assert(!puglSetViewHint(view, PUGL_GREEN_BITS, PUGL_DONT_CARE)); diff --git a/test/test_stub_hints.c b/test/test_stub_hints.c index 7720f0d..2dea844 100644 --- a/test/test_stub_hints.c +++ b/test/test_stub_hints.c @@ -49,6 +49,10 @@ main(void) puglSetEventFunc(view, onEvent); puglSetDefaultSize(view, 512, 512); + // Check invalid cases + assert(puglSetViewHint(view, (PuglViewHint)9999, 0) == PUGL_BAD_PARAMETER); + assert(puglGetViewHint(view, (PuglViewHint)9999) == PUGL_DONT_CARE); + // Set all relevant hints that support it to PUGL_DONT_CARE assert(!puglSetViewHint(view, PUGL_RED_BITS, PUGL_DONT_CARE)); assert(!puglSetViewHint(view, PUGL_GREEN_BITS, PUGL_DONT_CARE)); -- cgit v1.2.1