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.6 6.5
Change-Id: I1eb8a73f2beafec00c4a6f6b34bfd36a8d6e4d93
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 599328845c7e77bc7b4fd5b4f2de000bb463a814)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Axel Spoerl 2023-12-18 18:53:01 +01:00 committed by Qt Cherry-pick Bot
parent 9fb14df814
commit 49bfdf7e67

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