Created attachment 594531[details][diff][review]
patch v1
Turns out newWindowWithState() was the culprit. This patch fixes it by creating the window, setting the state, closing it and then restoring it. That's the only way can really test initial window states.