From 26816c21f60450e461a5b6ef4ef740f6070ce278 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Wed, 27 Jul 2016 02:26:47 +0200 Subject: Ported to the kasync revamp --- tests/dummyresourcebenchmark.cpp | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) (limited to 'tests/dummyresourcebenchmark.cpp') diff --git a/tests/dummyresourcebenchmark.cpp b/tests/dummyresourcebenchmark.cpp index 72562c3..8636bf6 100644 --- a/tests/dummyresourcebenchmark.cpp +++ b/tests/dummyresourcebenchmark.cpp @@ -44,34 +44,6 @@ private slots: { } - static KAsync::Job waitForCompletion(QList> &futures) - { - auto context = new QObject; - return KAsync::start([futures, context](KAsync::Future &future) { - const auto total = futures.size(); - auto count = QSharedPointer::create(); - int i = 0; - for (KAsync::Future subFuture : futures) { - i++; - if (subFuture.isFinished()) { - *count += 1; - continue; - } - // FIXME bind lifetime all watcher to future (repectively the main job - auto watcher = QSharedPointer>::create(); - QObject::connect(watcher.data(), &KAsync::FutureWatcher::futureReady, [count, total, &future]() { - *count += 1; - if (*count == total) { - future.setFinished(); - } - }); - watcher->setFuture(subFuture); - context->setProperty(QString("future%1").arg(i).toLatin1().data(), QVariant::fromValue(watcher)); - } - }) - .then([context]() { delete context; }); - } - // Ensure we can process a command in less than 0.1s void testCommandResponsiveness() { @@ -120,7 +92,7 @@ private slots: event.setProperty("summary", "summaryValue"); waitCondition << Sink::Store::create(event).exec(); } - waitForCompletion(waitCondition).exec().waitForFinished(); + KAsync::waitForCompletion(waitCondition).exec().waitForFinished(); auto appendTime = time.elapsed(); // Ensure everything is processed -- cgit v1.2.3