summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp')
-rw-r--r--tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp b/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp
index 6ec1b754d0..a3e549aa50 100644
--- a/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp
+++ b/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp
@@ -74,6 +74,7 @@ private slots:
void testOwnership();
void testBehindTheScenesDeletion();
void testUnparenting();
+ void testUnparentReparent();
void testActivation();
void testAncestorChange();
void testDockWidget();
@@ -241,6 +242,31 @@ void tst_QWindowContainer::testUnparenting()
QVERIFY(!window->isVisible());
}
+void tst_QWindowContainer::testUnparentReparent()
+{
+ QWidget root;
+
+ QWindow *window = new QWindow();
+ QScopedPointer<QWidget> container(QWidget::createWindowContainer(window, &root));
+ container->setWindowTitle(QTest::currentTestFunction());
+ container->setGeometry(m_availableGeometry.x() + 100, m_availableGeometry.y() + 100, 200, 100);
+
+ root.show();
+
+ QVERIFY(QTest::qWaitForWindowExposed(&root));
+
+ QTRY_VERIFY(window->isVisible());
+
+ container->setParent(nullptr);
+ QTRY_VERIFY(!window->isVisible());
+
+ container->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+ QTRY_VERIFY(window->isVisible());
+
+ container->setParent(&root); // This should not crash (QTBUG-63168)
+}
+
void tst_QWindowContainer::testAncestorChange()
{
QWidget root;