summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui/kernel
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2023-10-27 14:59:36 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2023-10-30 18:28:57 +0000
commitbe7e5f94a1c0e63d6e4dbea5649d12cdc879d8f6 (patch)
tree92b7e466da00d90f51dc8099410132e73dbff54f /tests/auto/gui/kernel
parenta9c47dde501d0e178a254920bd487dca956895be (diff)
macOS: Check NSWindow as well when determining if setVisible can bail out
In be268ae19731ab854931e43eea83e0e140ec2538 we made QCocoaWindow::setVisible idempotent by checking if NSView.hidden needed update. This failed to take into account the case when a window is moved from being a child window to a top level, where the window is still visible and the NSView's hidden state doesn't change, but we need to order in the NSWindow that we're now managing. We now check NSWindow.visible as well, if we're a top level window. Pick-to: 6.5 6.6 Change-Id: I94434d6ebfe2c9ece6eac7f83f17ead250ccc07a Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'tests/auto/gui/kernel')
-rw-r--r--tests/auto/gui/kernel/qwindow/tst_qwindow.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
index 12762c2800..c2cb5b2485 100644
--- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
+++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
@@ -94,6 +94,7 @@ private slots:
void enterLeaveOnWindowShowHide_data();
void enterLeaveOnWindowShowHide();
#endif
+ void windowExposedAfterReparent();
private:
QPoint m_availableTopLeft;
@@ -3007,6 +3008,25 @@ void tst_QWindow::enterLeaveOnWindowShowHide()
}
#endif
+void tst_QWindow::windowExposedAfterReparent()
+{
+ QWindow parent;
+ QWindow child(&parent);
+ child.show();
+ parent.show();
+
+ QVERIFY(QTest::qWaitForWindowExposed(&parent));
+ QVERIFY(QTest::qWaitForWindowExposed(&child));
+
+ child.setParent(nullptr);
+ QCoreApplication::processEvents();
+ QVERIFY(QTest::qWaitForWindowExposed(&child));
+
+ child.setParent(&parent);
+ QCoreApplication::processEvents();
+ QVERIFY(QTest::qWaitForWindowExposed(&child));
+}
+
#include <tst_qwindow.moc>
QTEST_MAIN(tst_QWindow)