From 2425bce76d4dbd723d46f97cdc5b65adc149f26c Mon Sep 17 00:00:00 2001 From: Axel Spoerl Date: Wed, 27 Mar 2024 12:13:04 +0100 Subject: [PATCH] Stabilize tst_QComboBox:popupPositionAfterStyleChange() Wait 2x double click interval, to make sure a double click is safely avoided. Use QTRY_COMPARE at the end of the function, to cover cases where a synchronously delivered mouse click causes posted events. Wrap the test implementation in #ifndef QT_NO_STYLE_FUSION, as is the declaration. Skip the test on QNX. Fixes: QTBUG-123798 Pick-to: 6.6 6.5 Change-Id: I73f4acb241a8c77a542152288c65f3d07582e075 Reviewed-by: Qt CI Bot Reviewed-by: Richard Moe Gustavsen (cherry picked from commit f7a809ab73182ef25578eb8fd200c223fa3eb0f5) Reviewed-by: Qt Cherry-pick Bot --- tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp index e16734b8021..5cd34e2ccd0 100644 --- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp @@ -3415,8 +3415,12 @@ void tst_QComboBox::task_QTBUG_56693_itemFontFromModel() box.hidePopup(); } +#ifndef QT_NO_STYLE_FUSION void tst_QComboBox::popupPositionAfterStyleChange() { +#ifdef Q_OS_QNX + QSKIP("Fails on QNX, QTBUG-123798"); +#endif // Check that the popup opens up centered on top of the current // index if the style has changed since the last time it was // opened (QTBUG-113765). @@ -3461,13 +3465,14 @@ void tst_QComboBox::popupPositionAfterStyleChange() QTest::mouseClick(&box, Qt::LeftButton); // Click on item under mouse. But wait a bit, to avoid a double click - QTest::qWait(qApp->styleHints()->mouseDoubleClickInterval()); + QTest::qWait(2 * QGuiApplication::styleHints()->mouseDoubleClickInterval()); QTest::mouseClick(&box, Qt::LeftButton); // Ensure that the item that was centered on top of the combobox, and which // we therefore clicked, was the same item we clicked on the first time. - QCOMPARE(box.currentText(), QStringLiteral("last")); + QTRY_COMPARE(box.currentText(), QStringLiteral("last")); } +#endif // QT_NO_STYLE_FUSION void tst_QComboBox::inputMethodUpdate() {