aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/mac.m5
-rw-r--r--test/test_realize.c6
2 files changed, 10 insertions, 1 deletions
diff --git a/src/mac.m b/src/mac.m
index 2a54134..4f5c08f 100644
--- a/src/mac.m
+++ b/src/mac.m
@@ -1007,10 +1007,15 @@ PuglStatus
puglRealize(PuglView* view)
{
PuglInternals* impl = view->impl;
+
if (impl->wrapperView) {
return PUGL_FAILURE;
}
+ if (!view->backend || !view->backend->configure) {
+ return PUGL_BAD_BACKEND;
+ }
+
const NSScreen* const screen = [NSScreen mainScreen];
const double scaleFactor = [screen backingScaleFactor];
diff --git a/test/test_realize.c b/test/test_realize.c
index 50eba46..cf2cde6 100644
--- a/test/test_realize.c
+++ b/test/test_realize.c
@@ -65,9 +65,13 @@ main(int argc, char** argv)
test.view = puglNewView(test.world);
puglSetClassName(test.world, "PuglTest");
puglSetWindowTitle(test.view, "Pugl Realize Test");
- puglSetBackend(test.view, puglStubBackend());
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);
+
puglSetSizeHint(test.view, PUGL_DEFAULT_SIZE, 512, 512);
// Create initially invisible window