diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 13b7f41dd..07e0db084 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -136,6 +136,7 @@ macro(add_test_file test_source gui_required) ) target_link_libraries(${TEST_NAME} PRIVATE ${QtCore_LIBRARIES} + ${QtConcurrent_LIBRARIES} ${QtWidgets_LIBRARIES} ${QtNetwork_LIBRARIES} ${QtSql_LIBRARIES} diff --git a/tests/src/concurrentrun_test.cpp b/tests/src/concurrentrun_test.cpp index a38811551..731181dca 100644 --- a/tests/src/concurrentrun_test.cpp +++ b/tests/src/concurrentrun_test.cpp @@ -2,11 +2,11 @@ #include +#include #include #include #include -#include "core/concurrentrun.h" #include "test_utils.h" int f(); @@ -17,7 +17,7 @@ int f() { TEST(ConcurrentRunTest, ConcurrentRun0StartAndWait) { QThreadPool threadpool; - QFuture future = ConcurrentRun::Run(&threadpool, &f); + QFuture future = QtConcurrent::run(&threadpool, &f); QFutureWatcher watcher; watcher.setFuture(future); QEventLoop loop; @@ -36,7 +36,7 @@ TEST(ConcurrentRunTest, ConcurrentRun1StartAndWait) { QThreadPool threadpool; int i = 1336; - QFuture future = ConcurrentRun::Run(&threadpool, &g, i); + QFuture future = QtConcurrent::run(&threadpool, &g, i); QFutureWatcher watcher; watcher.setFuture(future); QEventLoop loop; @@ -56,7 +56,7 @@ TEST(ConcurrentRunTest, ConcurrentRun2StartAndWait) { int i = 10; int j = 42; QThreadPool threadpool; - QFuture future = ConcurrentRun::Run(&threadpool, &max, i, j); + QFuture future = QtConcurrent::run(&threadpool, &max, i, j); QFutureWatcher watcher; watcher.setFuture(future); QEventLoop loop; @@ -77,7 +77,7 @@ TEST(ConcurrentRunTest, ConcurrentRun3StartAndWait) { int j = 42; int k = 50; QThreadPool threadpool; - QFuture future = ConcurrentRun::Run(&threadpool, &sum, i, j, k); + QFuture future = QtConcurrent::run(&threadpool, &sum, i, j, k); QFutureWatcher watcher; watcher.setFuture(future); QEventLoop loop; @@ -109,7 +109,7 @@ TEST(ConcurrentRunTest, ConcurrentRunVoidFunction1Start) { QThreadPool threadpool; int n = 10; - QFuture future = ConcurrentRun::Run(&threadpool, &aFunction, &n); + QFuture future = QtConcurrent::run(&threadpool, &aFunction, &n); QFutureWatcher watcher; watcher.setFuture(future); QEventLoop loop; @@ -124,7 +124,7 @@ TEST(ConcurrentRunTest, ConcurrentRunVoidFunction2Start) { QThreadPool threadpool; int n = 10, m = 11; - QFuture future = ConcurrentRun::Run(&threadpool, &bFunction, &n, &m); + QFuture future = QtConcurrent::run(&threadpool, &bFunction, &n, &m); QFutureWatcher watcher; watcher.setFuture(future); QEventLoop loop; @@ -140,7 +140,7 @@ TEST(ConcurrentRunTest, ConcurrentRunVoidFunction3Start) { QThreadPool threadpool; int n = 10, m = 11, o = 12; - QFuture future = ConcurrentRun::Run(&threadpool, &cFunction, &n, &m, &o); + QFuture future = QtConcurrent::run(&threadpool, &cFunction, &n, &m, &o); QFutureWatcher watcher; watcher.setFuture(future); QEventLoop loop; @@ -165,7 +165,7 @@ TEST(ConcurrentRunTest, ConcurrentRunVoidBindFunctionStart) { A a; int nb = 10; - QFuture future = ConcurrentRun::Run(&threadpool, std::bind(&A::f, &a, &nb)); + QFuture future = QtConcurrent::run(&threadpool, std::bind(&A::f, &a, &nb)); QFutureWatcher watcher; watcher.setFuture(future); QEventLoop loop;