From 21ef8bed6d738551c1a322e78366d3c347a0e09e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Lefebvre?= Date: Thu, 2 Jan 2025 10:03:39 +0100 Subject: [PATCH] Harden tst_QWindow::framePositioningStableAfterDestroy() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit StablePosition was in some cases recording a wrong position, as it was taking the framePosition and considering it to be the widget's position. That erroneous position was then used to place the window, resulting in a correct position but a wrong framePosition. Wait and check for the window.geometry() and the window.frameGeometry() to be different. If not the frame has not been updated, or there is no frame when there should be one. The test will most likely fail because of this. Fix flakiness on Opensuse 15 Pick-to: 6.9 6.8 6.5 Change-Id: I8e05ee7769de4efc2ac55ec7afbe366f76e325db Reviewed-by: Tor Arne Vestbø --- tests/auto/gui/kernel/qwindow/tst_qwindow.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp index 9c78d59383b..71fb2705f52 100644 --- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp +++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp @@ -678,14 +678,18 @@ void tst_QWindow::framePositioningStableAfterDestroy() window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); + const bool frameOk = QTest::qWaitFor([&]{return window.geometry() != window.frameGeometry(); }); + if (!frameOk) + qCritical() << "Frame geometry failed to update"; + const QPoint stablePosition = window.position(); const QPoint stableFramePosition = window.framePosition(); window.destroy(); window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); - QCOMPARE(window.position(), stablePosition); - QCOMPARE(window.framePosition(), stableFramePosition); + QTRY_COMPARE(window.position(), stablePosition); + QTRY_COMPARE(window.framePosition(), stableFramePosition); } void tst_QWindow::positioningDuringMinimized()