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 <Friedemann.Kleint@qt.io>
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
This commit is contained in:
Eskil Abrahamsen Blomfeldt 2021-03-01 08:20:45 +01:00
parent 30245c8515
commit ea310c1d0f
1 changed files with 2 additions and 1 deletions

View File

@ -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);