diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/CMakeLists.txt | 4 | ||||
-rw-r--r-- | tests/clientapitest.cpp | 18 | ||||
-rw-r--r-- | tests/hawd/dataset.cpp | 1 |
3 files changed, 12 insertions, 11 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 7b97264..35b3996 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt | |||
@@ -8,11 +8,10 @@ include_directories( | |||
8 | ${CMAKE_CURRENT_SOURCE_DIR}/../examples/ | 8 | ${CMAKE_CURRENT_SOURCE_DIR}/../examples/ |
9 | ) | 9 | ) |
10 | 10 | ||
11 | generate_flatbuffers(calendar) | ||
12 | |||
13 | macro(manual_tests) | 11 | macro(manual_tests) |
14 | foreach(_testname ${ARGN}) | 12 | foreach(_testname ${ARGN}) |
15 | add_executable(${_testname} ${_testname}.cpp) | 13 | add_executable(${_testname} ${_testname}.cpp) |
14 | generate_flatbuffers(${_testname} calendar) | ||
16 | qt5_use_modules(${_testname} Core Test Concurrent) | 15 | qt5_use_modules(${_testname} Core Test Concurrent) |
17 | target_link_libraries(${_testname} akonadi2common libhawd) | 16 | target_link_libraries(${_testname} akonadi2common libhawd) |
18 | endforeach(_testname) | 17 | endforeach(_testname) |
@@ -21,6 +20,7 @@ endmacro(manual_tests) | |||
21 | macro(auto_tests) | 20 | macro(auto_tests) |
22 | foreach(_testname ${ARGN}) | 21 | foreach(_testname ${ARGN}) |
23 | add_executable(${_testname} ${_testname}.cpp) | 22 | add_executable(${_testname} ${_testname}.cpp) |
23 | generate_flatbuffers(${_testname} calendar) | ||
24 | add_test(${_testname} ${_testname}) | 24 | add_test(${_testname} ${_testname}) |
25 | qt5_use_modules(${_testname} Core Test Concurrent) | 25 | qt5_use_modules(${_testname} Core Test Concurrent) |
26 | target_link_libraries(${_testname} akonadi2common libhawd) | 26 | target_link_libraries(${_testname} akonadi2common libhawd) |
diff --git a/tests/clientapitest.cpp b/tests/clientapitest.cpp index 1a5d873..1ff683f 100644 --- a/tests/clientapitest.cpp +++ b/tests/clientapitest.cpp | |||
@@ -24,13 +24,13 @@ class DummyResourceFacade : public Akonadi2::StoreFacade<Akonadi2::ApplicationDo | |||
24 | { | 24 | { |
25 | public: | 25 | public: |
26 | ~DummyResourceFacade(){}; | 26 | ~DummyResourceFacade(){}; |
27 | Async::Job<void> create(const Akonadi2::ApplicationDomain::Event &domainObject) Q_DECL_OVERRIDE { return Async::null<void>(); }; | 27 | KAsync::Job<void> create(const Akonadi2::ApplicationDomain::Event &domainObject) Q_DECL_OVERRIDE { return KAsync::null<void>(); }; |
28 | Async::Job<void> modify(const Akonadi2::ApplicationDomain::Event &domainObject) Q_DECL_OVERRIDE { return Async::null<void>(); }; | 28 | KAsync::Job<void> modify(const Akonadi2::ApplicationDomain::Event &domainObject) Q_DECL_OVERRIDE { return KAsync::null<void>(); }; |
29 | Async::Job<void> remove(const Akonadi2::ApplicationDomain::Event &domainObject) Q_DECL_OVERRIDE { return Async::null<void>(); }; | 29 | KAsync::Job<void> remove(const Akonadi2::ApplicationDomain::Event &domainObject) Q_DECL_OVERRIDE { return KAsync::null<void>(); }; |
30 | 30 | ||
31 | Async::Job<qint64> load(const Akonadi2::Query &query, const std::function<void(const Akonadi2::ApplicationDomain::Event::Ptr &)> &resultCallback) | 31 | KAsync::Job<qint64> load(const Akonadi2::Query &query, const std::function<void(const Akonadi2::ApplicationDomain::Event::Ptr &)> &resultCallback) |
32 | { | 32 | { |
33 | return Async::start<qint64>([this, resultCallback](Async::Future<qint64> &future) { | 33 | return KAsync::start<qint64>([this, resultCallback](KAsync::Future<qint64> &future) { |
34 | qDebug() << "load called"; | 34 | qDebug() << "load called"; |
35 | for(const auto &result : results) { | 35 | for(const auto &result : results) { |
36 | resultCallback(result); | 36 | resultCallback(result); |
@@ -40,16 +40,16 @@ public: | |||
40 | }); | 40 | }); |
41 | } | 41 | } |
42 | 42 | ||
43 | Async::Job<void> load(const Akonadi2::Query &query, const QSharedPointer<Akonadi2::ResultProvider<Akonadi2::ApplicationDomain::Event::Ptr> > &resultProvider) Q_DECL_OVERRIDE | 43 | KAsync::Job<void> load(const Akonadi2::Query &query, const QSharedPointer<Akonadi2::ResultProvider<Akonadi2::ApplicationDomain::Event::Ptr> > &resultProvider) Q_DECL_OVERRIDE |
44 | { | 44 | { |
45 | auto runner = QSharedPointer<QueryRunner>::create(query); | 45 | auto runner = QSharedPointer<QueryRunner>::create(query); |
46 | //The runner only lives as long as the resultProvider | 46 | //The runner only lives as long as the resultProvider |
47 | resultProvider->setQueryRunner(runner); | 47 | resultProvider->setQueryRunner(runner); |
48 | QWeakPointer<Akonadi2::ResultProvider<Akonadi2::ApplicationDomain::Event::Ptr> > weakResultProvider = resultProvider; | 48 | QWeakPointer<Akonadi2::ResultProvider<Akonadi2::ApplicationDomain::Event::Ptr> > weakResultProvider = resultProvider; |
49 | capturedResultProvider = resultProvider; | 49 | capturedResultProvider = resultProvider; |
50 | runner->setQuery([this, weakResultProvider, query](qint64 oldRevision, qint64 newRevision) -> Async::Job<qint64> { | 50 | runner->setQuery([this, weakResultProvider, query](qint64 oldRevision, qint64 newRevision) -> KAsync::Job<qint64> { |
51 | qDebug() << "Creating query for revisions: " << oldRevision << newRevision; | 51 | qDebug() << "Creating query for revisions: " << oldRevision << newRevision; |
52 | return Async::start<qint64>([this, weakResultProvider, query](Async::Future<qint64> &future) { | 52 | return KAsync::start<qint64>([this, weakResultProvider, query](KAsync::Future<qint64> &future) { |
53 | auto resultProvider = weakResultProvider.toStrongRef(); | 53 | auto resultProvider = weakResultProvider.toStrongRef(); |
54 | if (!resultProvider) { | 54 | if (!resultProvider) { |
55 | Warning() << "Tried executing query after result provider is already gone"; | 55 | Warning() << "Tried executing query after result provider is already gone"; |
@@ -81,7 +81,7 @@ public: | |||
81 | }); | 81 | }); |
82 | } | 82 | } |
83 | 83 | ||
84 | return Async::start<void>([runner](Async::Future<void> &future) { | 84 | return KAsync::start<void>([runner](KAsync::Future<void> &future) { |
85 | runner->run().then<void>([&future]() { | 85 | runner->run().then<void>([&future]() { |
86 | //TODO if not live query, destroy runner. | 86 | //TODO if not live query, destroy runner. |
87 | future.setFinished(); | 87 | future.setFinished(); |
diff --git a/tests/hawd/dataset.cpp b/tests/hawd/dataset.cpp index 9f1d307..b068b66 100644 --- a/tests/hawd/dataset.cpp +++ b/tests/hawd/dataset.cpp | |||
@@ -22,6 +22,7 @@ | |||
22 | 22 | ||
23 | #include <QDateTime> | 23 | #include <QDateTime> |
24 | #include <QDebug> | 24 | #include <QDebug> |
25 | #include <QDataStream> | ||
25 | 26 | ||
26 | #include <iostream> | 27 | #include <iostream> |
27 | 28 | ||