Fix flaky tst_QWindow::windowExposedAfterReparent on Ubuntu 24.04

tst_QWindow::windowExposedAfterReparent is flaky on Ubuntu 24.04. The
child qwindow being reparented is not correctly converted to a toplevel
window by the window manager.

Close the child qwindow before reparenting it.

Fixes: QTBUG-129023
Change-Id: I9152e4cc3acd3ac757cb5e3b18669a07acd82e33
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
This commit is contained in:
Frédéric Lefebvre 2025-06-30 16:22:49 +02:00 committed by Frederic Lefebvre
parent f54683155d
commit aa52e34173
2 changed files with 4 additions and 3 deletions

View File

@ -3264,12 +3264,14 @@ void tst_QWindow::windowExposedAfterReparent()
QVERIFY(QTest::qWaitForWindowExposed(&parent)); QVERIFY(QTest::qWaitForWindowExposed(&parent));
QVERIFY(QTest::qWaitForWindowExposed(&child)); QVERIFY(QTest::qWaitForWindowExposed(&child));
// Close the child before reparenting it to ensure it is correctly converted
// to a toplevel window by the window manager.
child.close();
child.setParent(nullptr); child.setParent(nullptr);
QCoreApplication::processEvents(); child.show();
QVERIFY(QTest::qWaitForWindowExposed(&child)); QVERIFY(QTest::qWaitForWindowExposed(&child));
child.setParent(&parent); child.setParent(&parent);
QCoreApplication::processEvents();
QVERIFY(QTest::qWaitForWindowExposed(&child)); QVERIFY(QTest::qWaitForWindowExposed(&child));
} }

View File

@ -1,3 +1,2 @@
[layoutDirection] [layoutDirection]
ubuntu-22.04 ubuntu-22.04
ubuntu-24.04