From ea310c1d0f4d9bb66c118407cc9e70e6e2a2d724 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 1 Mar 2021 08:20:45 +0100 Subject: [PATCH] Fix tst_QDialog::keepPositionOnClose on Wayland The test assumed that dialog.move() would actually move the dialog box to the requested location, which is an invalid assumption on Wayland. Since the objective of the test is not to check if move() works this way, but to check whether the dialog box shows up in the same location when it is re-shown, we actually fetch the pos after showing it the first time, rather than assume this is the same as the requested one. Task-number: QTBUG-91418 Change-Id: Ifa21fa08429f198988f90d7ee328e4f35a4764c2 Reviewed-by: Friedemann Kleint Reviewed-by: Paul Olav Tvete --- tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp index 53c33255bf..6a59edca10 100644 --- a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp +++ b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp @@ -552,10 +552,11 @@ void tst_QDialog::keepPositionOnClose() dialog.setWindowTitle(QTest::currentTestFunction()); const QRect availableGeometry = QGuiApplication::primaryScreen()->availableGeometry(); dialog.resize(availableGeometry.size() / 4); - const QPoint pos = availableGeometry.topLeft() + QPoint(100, 100); + QPoint pos = availableGeometry.topLeft() + QPoint(100, 100); dialog.move(pos); dialog.show(); QVERIFY(QTest::qWaitForWindowExposed(&dialog)); + pos = dialog.pos(); dialog.close(); dialog.windowHandle()->destroy(); // Emulate a click on close by destroying the window. QTest::qWait(50);