summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@theqtcompany.com>2015-09-24 11:03:38 +0200
committerEdward Welbourne <edward.welbourne@theqtcompany.com>2015-09-30 08:25:34 +0000
commitb86efb1ab9daa76965cda5bdebb225c9e3762e8e (patch)
tree78f04de08960cf5e1d79924411738e78799fcd87 /tests/auto
parent0ebebeb983d381010fae710aee60d8550d9be4f3 (diff)
Initialize QFutureWatcherBasePrivate::finished and test
It's accessed by QFutureWatcherBase::isFinished(), potentially before anything has set it. It gets to be initially true until setFuture() has given it us unfinished future and set it false. Add a regression test for matching state in future and watcher. Task-number: QTBUG-12358 Change-Id: Iae7bdaa434ab80f518afe4d7d55df99c391991a4 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/corelib/thread/qfuturewatcher/tst_qfuturewatcher.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/auto/corelib/thread/qfuturewatcher/tst_qfuturewatcher.cpp b/tests/auto/corelib/thread/qfuturewatcher/tst_qfuturewatcher.cpp
index 60a4d749c9..5ec32b1d02 100644
--- a/tests/auto/corelib/thread/qfuturewatcher/tst_qfuturewatcher.cpp
+++ b/tests/auto/corelib/thread/qfuturewatcher/tst_qfuturewatcher.cpp
@@ -68,6 +68,7 @@ private slots:
void incrementalFilterResults();
void qfutureSynchronizer();
void warnRace();
+ void matchFlags();
};
void sleeper()
@@ -930,5 +931,17 @@ void tst_QFutureWatcher::warnRace()
future.waitForFinished();
}
+void tst_QFutureWatcher::matchFlags()
+{
+ /* Regression test: expect a default watcher to be in the same state as a
+ * default future. */
+ QFutureWatcher<int> watcher;
+ QFuture<int> future;
+ QCOMPARE(watcher.isStarted(), future.isStarted());
+ QCOMPARE(watcher.isCanceled(), future.isCanceled());
+ QCOMPARE(watcher.isFinished(), future.isFinished());
+}
+
+
QTEST_MAIN(tst_QFutureWatcher)
#include "tst_qfuturewatcher.moc"