diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2020-03-11 21:02:03 +0100 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2020-03-12 18:46:44 +0100 |
commit | 7d20f86958522bf1bdbaeaf8c0e395453c463058 (patch) | |
tree | 43d87acd22eef035394a29e20f5f9c6c63f733ff | |
parent | 476d296f42be63009cd06c8a6480176068535d00 (diff) |
Stabilize and rename tst_qmessagebox::expandDetails_QTBUG_32473
This has been flaky on OpenSuSE; if the stored geom.topLeft() is 0,0
it apparently means the window manager (probably kwin) didn't get around
to decorating and repositioning the dialog by the time
qWaitForWindowExposed() returns. Because we check later to see whether
it moved, we need to be certain of its initial position.
Waiting for the extra "fleece" widget to be shown was based on the
theory that by the time the X server has processed messages related
to that new window, the WM should be done processing the consequences
of the resized dialog window. But there's no such guarantee, so let's
try removing that. On the other hand, removing the delay does open
us up to miss a regression (maybe the dialog gets moved after we have
checked that it didn't move).
Rename because we don't name autotests after bugs.
Amends 26ddb586acd49834c7cffac781ce504ec78635cc
Task-number: QTBUG-32473
Change-Id: I6bbfe2b4baaee389db0d4112f0fec3b7cb9da554
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Liang Qi <liang.qi@qt.io>
-rw-r--r-- | tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp b/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp index 76314564f1..543128915e 100644 --- a/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp +++ b/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp @@ -51,7 +51,7 @@ private slots: void about(); void detailsText(); void detailsButtonText(); - void expandDetails_QTBUG_32473(); + void expandDetailsWithoutMoving(); #ifndef Q_OS_MAC void shortcut(); @@ -499,7 +499,7 @@ void tst_QMessageBox::detailsButtonText() } } -void tst_QMessageBox::expandDetails_QTBUG_32473() +void tst_QMessageBox::expandDetailsWithoutMoving() // QTBUG-32473 { tst_ResizingMessageBox box; box.setDetailedText("bla"); @@ -516,18 +516,14 @@ void tst_QMessageBox::expandDetails_QTBUG_32473() auto moreButton = *it; QVERIFY(QTest::qWaitForWindowExposed(&box)); + QTRY_VERIFY2(!box.geometry().topLeft().isNull(), "window manager is expected to decorate and position the dialog"); QRect geom = box.geometry(); box.resized = false; + // now click the "more" button, and verify that the dialog resizes but does not move moreButton->click(); QTRY_VERIFY(box.resized); - // After we receive the expose event for a second widget, it's likely - // that the window manager is also done manipulating the first QMessageBox. - QWidget fleece; - fleece.show(); - QVERIFY(QTest::qWaitForWindowExposed(&fleece)); - if (geom.topLeft() == box.geometry().topLeft()) - QTest::qWait(500); - QCOMPARE(geom.topLeft(), box.geometry().topLeft()); + QVERIFY(box.geometry().height() > geom.height()); + QCOMPARE(box.geometry().topLeft(), geom.topLeft()); } void tst_QMessageBox::incorrectDefaultButton() |