Stabilize tst_QMessageBox::hideNativeByDestruction()

The test was flaky, because of qWaitForWindowActive() after show().
It is not guaranteed, that a window has focus after show().
Use qWaitForWindowExposed() instead.

Task-number: QTBUG-118489
Pick-to: 6.7 6.6 6.5
Change-Id: I1eb8a73f2beafec00c4a6f6b34bfd36a8d6e4d93
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
bb10
Axel Spoerl 2023-12-18 18:53:01 +01:00
parent 09eb99f011
commit 599328845c
1 changed files with 1 additions and 1 deletions

View File

@ -796,7 +796,7 @@ void tst_QMessageBox::hideNativeByDestruction()
// Make it application modal so that we don't end up with a sheet on macOS
dialog->setWindowModality(Qt::ApplicationModal);
window.show();
QVERIFY(QTest::qWaitForWindowActive(&window));
QVERIFY(QTest::qWaitForWindowExposed(&window));
dialog->open();
// We test that the dialog opens and closes by watching the activation of the