Skip to content

Commit

Permalink
tests: remove processEvents calls as it's a Qt implementation detail
Browse files Browse the repository at this point in the history
Instead use QTRY_COMPARE to wait for the value to change, as on
some machines this may take more than one event loop.
  • Loading branch information
ahayzen-kdab authored and LeonMatthesKDAB committed Oct 6, 2022
1 parent eae0214 commit 6250d6f
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions tests/basic_cxx_qt/cpp/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,7 @@ private Q_SLOTS:
QCOMPARE(obj.fetchUpdateCallCount(), 0);
obj.queueTest();
QCOMPARE(obj.fetchUpdateCallCount(), 0);
QCoreApplication::processEvents();
QCOMPARE(obj.fetchUpdateCallCount(), 1);
QTRY_COMPARE(obj.fetchUpdateCallCount(), 1);
}

// CXX-Qt allows Rust code to queue multiple requests
Expand All @@ -108,8 +107,7 @@ private Q_SLOTS:
obj.queueTest();
obj.queueTest();
QCOMPARE(obj.fetchUpdateCallCount(), 0);
QCoreApplication::processEvents();
QCOMPARE(obj.fetchUpdateCallCount(), 2);
QTRY_COMPARE(obj.fetchUpdateCallCount(), 2);
}

// CXX-Qt allows Rust code to queue requests in multiple threads
Expand All @@ -119,8 +117,7 @@ private Q_SLOTS:
QCOMPARE(obj.fetchUpdateCallCount(), 0);
obj.queueTestMultiThread();
QCOMPARE(obj.fetchUpdateCallCount(), 0);
QCoreApplication::processEvents();
QCOMPARE(obj.fetchUpdateCallCount(), 100);
QTRY_COMPARE(obj.fetchUpdateCallCount(), 100);
}

// CXX-Qt types are exposed to C++ correctly
Expand Down

0 comments on commit 6250d6f

Please sign in to comment.