diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-01-14 18:22:36 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-01-14 18:22:36 +0100 |
commit | fd9703a6f990d965d1c7fba21fee36b2beef644e (patch) | |
tree | 1587bb9080ec6de0ead8d8cfc0f69b8ed3445cbd /tests/clientapitest.cpp | |
parent | c4ec8fbc9f95a67079bc011c6455c3de72fa8266 (diff) | |
download | sink-fd9703a6f990d965d1c7fba21fee36b2beef644e.tar.gz sink-fd9703a6f990d965d1c7fba21fee36b2beef644e.zip |
An imperative query API
Diffstat (limited to 'tests/clientapitest.cpp')
-rw-r--r-- | tests/clientapitest.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/clientapitest.cpp b/tests/clientapitest.cpp index ff79c82..5942849 100644 --- a/tests/clientapitest.cpp +++ b/tests/clientapitest.cpp | |||
@@ -279,6 +279,26 @@ private Q_SLOTS: | |||
279 | QCOMPARE(childrenFetchedCount, 1); | 279 | QCOMPARE(childrenFetchedCount, 1); |
280 | } | 280 | } |
281 | 281 | ||
282 | void testImperativeLoad() | ||
283 | { | ||
284 | auto facade = DummyResourceFacade<Akonadi2::ApplicationDomain::Event>::registerFacade(); | ||
285 | facade->results << QSharedPointer<Akonadi2::ApplicationDomain::Event>::create("resource", "id", 0, QSharedPointer<Akonadi2::ApplicationDomain::MemoryBufferAdaptor>::create()); | ||
286 | ResourceConfig::addResource("dummyresource.instance1", "dummyresource"); | ||
287 | |||
288 | Akonadi2::Query query; | ||
289 | query.resources << "dummyresource.instance1"; | ||
290 | query.liveQuery = false; | ||
291 | |||
292 | bool gotValue = false; | ||
293 | auto result = Akonadi2::Store::fetchOne<Akonadi2::ApplicationDomain::Event>(query) | ||
294 | .then<void, Akonadi2::ApplicationDomain::Event>([&gotValue](const Akonadi2::ApplicationDomain::Event &event) { | ||
295 | gotValue = true; | ||
296 | }).exec(); | ||
297 | result.waitForFinished(); | ||
298 | QVERIFY(!result.errorCode()); | ||
299 | QVERIFY(gotValue); | ||
300 | } | ||
301 | |||
282 | 302 | ||
283 | }; | 303 | }; |
284 | 304 | ||