Closing the dialog at the end of the test ends the modal session via
QCocoaEventDispatcherPrivate::endModalSession(), but the actual ending
of the session is deferred to cleanupModalSessions(), and that is never called.
The result is that QCocoaWindow::setVisible of the window in testKeyPressOnToplevel
and following tests ends up calling [m_nsWindow orderFront:nil]; instead of
[m_nsWindow makeKeyAndOrderFront:nil];, leaving the window inactive and the
tests failing.
Task-number: QTBUG-58474
Change-Id: If66b2e201f658b627c2ec50a562938f59a5037ed
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>