|
22 | 22 | #include <QObject> |
23 | 23 | #include "qgstest.h" |
24 | 24 |
|
| 25 | +// some of these tests have intermittent failure on Travis, probably due |
| 26 | +// to inconsistent availability to multiple threads on the platform. |
| 27 | +// These tests are disabled unless WITH_FLAKY is 1. |
| 28 | + |
| 29 | +#define WITH_FLAKY 0 //TODO - disable only for Travis? |
| 30 | + |
25 | 31 | class TestTask : public QgsTask |
26 | 32 | { |
27 | 33 | Q_OBJECT |
@@ -194,13 +200,15 @@ class TestQgsTaskManager : public QObject |
194 | 200 | void task(); |
195 | 201 | void taskResult(); |
196 | 202 | void taskFinished(); |
197 | | -#if 0 //flaky |
| 203 | +#if WITH_FLAKY |
198 | 204 | void subTask(); |
199 | 205 | #endif |
200 | 206 | void addTask(); |
201 | 207 | void taskTerminationBeforeDelete(); |
202 | 208 | void taskId(); |
| 209 | +#if WITH_FLAKY |
203 | 210 | void waitForFinished(); |
| 211 | +#endif |
204 | 212 | void progressChanged(); |
205 | 213 | void statusChanged(); |
206 | 214 | void allTasksFinished(); |
@@ -434,7 +442,7 @@ void TestQgsTaskManager::taskFinished() |
434 | 442 | QCOMPARE( *resultObtained, false ); |
435 | 443 | } |
436 | 444 |
|
437 | | -#if 0 //flaky |
| 445 | +#if WITH_FLAKY |
438 | 446 | void TestQgsTaskManager::subTask() |
439 | 447 | { |
440 | 448 | QgsTaskManager manager; |
@@ -657,6 +665,7 @@ void TestQgsTaskManager::taskId() |
657 | 665 | delete task3; |
658 | 666 | } |
659 | 667 |
|
| 668 | +#if WITH_FLAKY |
660 | 669 | void TestQgsTaskManager::waitForFinished() |
661 | 670 | { |
662 | 671 | QgsTaskManager manager; |
@@ -696,6 +705,7 @@ void TestQgsTaskManager::waitForFinished() |
696 | 705 | QCOMPARE( timeoutTooShortTask->waitForFinished( 20 ), false ); |
697 | 706 | QCOMPARE( timeoutTooShortTask->status(), QgsTask::Running ); |
698 | 707 | } |
| 708 | +#endif |
699 | 709 |
|
700 | 710 | void TestQgsTaskManager::progressChanged() |
701 | 711 | { |
@@ -1115,7 +1125,7 @@ void TestQgsTaskManager::managerWithSubTasks() |
1115 | 1125 | QCOMPARE( manager->activeTasks().count(), 1 ); |
1116 | 1126 | QVERIFY( manager->activeTasks().contains( parent ) ); |
1117 | 1127 | QCOMPARE( spy.count(), 1 ); |
1118 | | -#if 0 // flaky |
| 1128 | +#if WITH_FLAKY |
1119 | 1129 | //manager should not directly listen to progress reports from subtasks |
1120 | 1130 | //(only parent tasks, which themselves include their subtask progress) |
1121 | 1131 | QCOMPARE( spyProgress.count(), 0 ); |
|
0 commit comments