diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2021-11-25 22:41:06 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-11-26 14:10:12 +0000 |
commit | 5dc3441fa9998e6b2dd068c55db9f99c4f1d2311 (patch) | |
tree | 42ba763cf55e164600d5f61cc369cae284ebcc7a /tests | |
parent | 362383b33cc3c1f9ab8fde740027d6d2a3a61e03 (diff) |
Stabilize tst_QAccessibilityMac
Introduce a TRY_EXPECT macro that uses qWaitFor, and use it whenever
EXPECT was used after a call to processEvents.
Fixes: QTBUG-94036
Change-Id: Ia935444d529c2798637bf9b4a56e47a8dc9d75d2
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
(cherry picked from commit 24022bc76080f1881755df839b41a1003a1ed125)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.mm | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.mm b/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.mm index b7c3c2643b..7e89b3a166 100644 --- a/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.mm +++ b/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.mm @@ -86,6 +86,7 @@ QDebug operator<<(QDebug dbg, AXErrorTag err) return false; \ } \ +#define TRY_EXPECT(cond) EXPECT(QTest::qWaitFor([&]{ return (cond); })) @interface TestAXObject : NSObject { @@ -546,21 +547,17 @@ bool notifications(QWidget *w) EXPECT(notificationList.length() == 0); le2->setFocus(); - QCoreApplication::processEvents(); - EXPECT(notificationList.length() == 1); - EXPECT(notificationList.at(0) == QAccessible::Focus); + TRY_EXPECT(notificationList.length() == 1); + TRY_EXPECT(notificationList.at(0) == QAccessible::Focus); le1->setFocus(); - QCoreApplication::processEvents(); - EXPECT(notificationList.length() == 2); - EXPECT(notificationList.at(1) == QAccessible::Focus); + TRY_EXPECT(notificationList.length() == 2); + TRY_EXPECT(notificationList.at(1) == QAccessible::Focus); le1->setText("hello"); - QCoreApplication::processEvents(); - EXPECT(notificationList.length() == 3); - EXPECT(notificationList.at(2) == QAccessible::ValueChanged); + TRY_EXPECT(notificationList.length() == 3); + TRY_EXPECT(notificationList.at(2) == QAccessible::ValueChanged); le1->setText("foo"); - QCoreApplication::processEvents(); - EXPECT(notificationList.length() == 4); - EXPECT(notificationList.at(3) == QAccessible::ValueChanged); + TRY_EXPECT(notificationList.length() == 4); + TRY_EXPECT(notificationList.at(3) == QAccessible::ValueChanged); return true; } |