summaryrefslogtreecommitdiffstats
path: root/async/autotests/asynctest.cpp
diff options
context:
space:
mode:
authorDan Vrátil <dvratil@redhat.com>2014-12-14 13:11:47 +0100
committerDan Vrátil <dvratil@redhat.com>2014-12-14 13:11:47 +0100
commit8618af7252260e1c283de20bc4cfd64d63b68770 (patch)
tree8375465836a5417bf61b4f5320a275e3a756c411 /async/autotests/asynctest.cpp
parent664396b0e550910cea50b7852066a04cc7fec3bd (diff)
downloadsink-8618af7252260e1c283de20bc4cfd64d63b68770.tar.gz
sink-8618af7252260e1c283de20bc4cfd64d63b68770.zip
Async: bring back synchronous Future::waitForFinished()
Diffstat (limited to 'async/autotests/asynctest.cpp')
-rw-r--r--async/autotests/asynctest.cpp15
1 files changed, 1 insertions, 14 deletions
diff --git a/async/autotests/asynctest.cpp b/async/autotests/asynctest.cpp
index 000bb2a..ffbce9e 100644
--- a/async/autotests/asynctest.cpp
+++ b/async/autotests/asynctest.cpp
@@ -37,19 +37,6 @@ public:
37 ~AsyncTest() 37 ~AsyncTest()
38 {} 38 {}
39 39
40private:
41 template<typename T>
42 bool waitForFuture(const Async::Future<T> &f)
43 {
44 QEventLoop eventLoop;
45 Async::FutureWatcher<T> watcher;
46 connect(&watcher, &Async::FutureWatcher<T>::futureReady,
47 &eventLoop, &QEventLoop::quit);
48 watcher.setFuture(f);
49 eventLoop.exec();
50 return true;
51 }
52
53private Q_SLOTS: 40private Q_SLOTS:
54 void testSyncPromises(); 41 void testSyncPromises();
55 void testAsyncPromises(); 42 void testAsyncPromises();
@@ -100,7 +87,7 @@ void AsyncTest::testAsyncPromises()
100 87
101 Async::Future<int> future = job.exec(); 88 Async::Future<int> future = job.exec();
102 89
103 QVERIFY(waitForFuture<int>(future)); 90 future.waitForFinished();
104 QCOMPARE(future.value(), 42); 91 QCOMPARE(future.value(), 42);
105} 92}
106 93