[office/calligraplan] src/libs/widgets/tests: use QTRY_COMPARE instead of QCOMPARE and remove timer used to wait the update (more reproductible unit test)
Mickael Sergent <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit 2dd8ad3ba40e1d354c0686ad32f8dc160b7268d7 by Mickael Sergent.
Committed on 30/07/2026 at 16:01.
Pushed by miko into branch 'master'.
use QTRY_COMPARE instead of QCOMPARE and remove timer used to wait the update (more reproductible unit test)
M +4 -8 src/libs/widgets/tests/KoProgressUpdater_test.cpp
https://invent.kde.org/office/calligraplan/-/commit/2dd8ad3ba40e1d354c0686ad32f8dc160b7268d7
diff --git a/src/libs/widgets/tests/KoProgressUpdater_test.cpp b/src/libs/widgets/tests/KoProgressUpdater_test.cpp
index d9c3d1f3..10ca14ee 100644
--- a/src/libs/widgets/tests/KoProgressUpdater_test.cpp
+++ b/src/libs/widgets/tests/KoProgressUpdater_test.cpp
@@ -142,11 +142,9 @@ void KoProgressUpdaterTest::testSimpleProgress()
pu.start();
QPointer<KoUpdater> updater = pu.startSubtask();
updater->setProgress(50);
- QTest::qWait(WAIT_FOR_PROGRESSUPDATER_UI_UPDATES); // allow the action to do its job.
- QCOMPARE(bar.value, 50);
+ QTRY_COMPARE(bar.value, 50);
updater->setProgress(100);
- QTest::qWait(WAIT_FOR_PROGRESSUPDATER_UI_UPDATES); // allow the action to do its job.
- QCOMPARE(bar.value, 100);
+ QTRY_COMPARE(bar.value, 100);
}
void KoProgressUpdaterTest::testSimpleThreadedProgress()
{
@@ -174,13 +172,11 @@ void KoProgressUpdaterTest::testSubUpdaters()
QPointer<KoUpdater> u1 = pu.startSubtask(4);
QPointer<KoUpdater> u2 = pu.startSubtask(6);
u1->setProgress(100);
- QTest::qWait(WAIT_FOR_PROGRESSUPDATER_UI_UPDATES); // allow the action to do its job.
QCoreApplication::processEvents(); // allow the actions 'gui' stuff to run.
- QCOMPARE(bar.value, 40);
+ QTRY_COMPARE(bar.value, 40);
u2->setProgress(100);
- QTest::qWait(WAIT_FOR_PROGRESSUPDATER_UI_UPDATES); // allow the action to do its job.
QCoreApplication::processEvents(); // allow the actions 'gui' stuff to run.
- QCOMPARE(bar.value, 100);
+ QTRY_COMPARE(bar.value, 100);
}
void KoProgressUpdaterTest::testThreadedSubUpdaters()