Fix flaky tst_QMdiArea::currentSubWindow()

tst_QMdiArea::currentSubWindow() is flaky and fails when the
dummyTopLevel window is not marked as active before verification.

Verify that the dummyTopLevel is active, before checking what is the
active topLevel window.

Fix the flakiness of tst_QMdiArea::currentSubWindow() on Ubuntu 24.

Pick-to: 6.8 6.5
Change-Id: If5b85713d0bfec40e2722c471f7c3ba5ac73171c
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 6c7f61f0817754b0abcf0a93ce5cf26fd5251cb4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Frédéric Lefebvre 2025-05-05 13:02:31 +02:00 committed by Qt Cherry-pick Bot
parent 29d030b246
commit 1efb21ba00

View File

@ -1002,6 +1002,7 @@ void tst_QMdiArea::currentSubWindow()
QLineEdit dummyTopLevel;
dummyTopLevel.show();
QVERIFY(QTest::qWaitForWindowExposed(&dummyTopLevel));
QVERIFY(QTest::qWaitForWindowActive(&dummyTopLevel));
// Move focus to another top-level and check that we still
// have an active window.