summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/dialogs/qdialog
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/widgets/dialogs/qdialog')
-rw-r--r--tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp
index 9ef64480d6..53c33255bf 100644
--- a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp
+++ b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp
@@ -80,6 +80,7 @@ private slots:
void transientParent_data();
void transientParent();
void dialogInGraphicsView();
+ void keepPositionOnClose();
};
// Testing get/set functions
@@ -543,5 +544,26 @@ void tst_QDialog::dialogInGraphicsView()
}
}
+// QTBUG-79147 (Windows): Closing a dialog by clicking the 'X' in the title
+// bar would offset the dialog position when shown next time.
+void tst_QDialog::keepPositionOnClose()
+{
+ QDialog dialog;
+ dialog.setWindowTitle(QTest::currentTestFunction());
+ const QRect availableGeometry = QGuiApplication::primaryScreen()->availableGeometry();
+ dialog.resize(availableGeometry.size() / 4);
+ const QPoint pos = availableGeometry.topLeft() + QPoint(100, 100);
+ dialog.move(pos);
+ dialog.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&dialog));
+ dialog.close();
+ dialog.windowHandle()->destroy(); // Emulate a click on close by destroying the window.
+ QTest::qWait(50);
+ dialog.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&dialog));
+ QTest::qWait(50);
+ QCOMPARE(dialog.pos(), pos);
+}
+
QTEST_MAIN(tst_QDialog)
#include "tst_qdialog.moc"