diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-10-20 15:50:52 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-10-20 15:50:52 +0200 |
commit | 7a456d8a8687d7a960c0f8c4bfb18eed3754404c (patch) | |
tree | fd3e77c5ff6885fcf5a1dd7e1722197904b6ec65 /tests/dummyresourcetest.cpp | |
parent | 43c4cd555e4a265d3e484dfeea0aa05da0977cd0 (diff) | |
download | sink-7a456d8a8687d7a960c0f8c4bfb18eed3754404c.tar.gz sink-7a456d8a8687d7a960c0f8c4bfb18eed3754404c.zip |
Test & fix live query removals
Diffstat (limited to 'tests/dummyresourcetest.cpp')
-rw-r--r-- | tests/dummyresourcetest.cpp | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/tests/dummyresourcetest.cpp b/tests/dummyresourcetest.cpp index 93a6a9c..731f013 100644 --- a/tests/dummyresourcetest.cpp +++ b/tests/dummyresourcetest.cpp | |||
@@ -225,6 +225,56 @@ private Q_SLOTS: | |||
225 | } | 225 | } |
226 | } | 226 | } |
227 | 227 | ||
228 | void testWriteModifyDeleteLive() | ||
229 | { | ||
230 | |||
231 | Akonadi2::Query query; | ||
232 | query.resources << "org.kde.dummy.instance1"; | ||
233 | query.syncOnDemand = false; | ||
234 | query.processAll = true; | ||
235 | query.liveQuery = true; | ||
236 | query.propertyFilter.insert("uid", "testuid"); | ||
237 | |||
238 | |||
239 | async::SyncListResult<Akonadi2::ApplicationDomain::Event::Ptr> result(Akonadi2::Store::load<Akonadi2::ApplicationDomain::Event>(query)); | ||
240 | result.exec(); | ||
241 | |||
242 | Akonadi2::ApplicationDomain::Event event; | ||
243 | event.setProperty("uid", "testuid"); | ||
244 | QCOMPARE(event.getProperty("uid").toByteArray(), QByteArray("testuid")); | ||
245 | event.setProperty("summary", "summaryValue"); | ||
246 | Akonadi2::Store::create<Akonadi2::ApplicationDomain::Event>(event, "org.kde.dummy.instance1").exec().waitForFinished(); | ||
247 | |||
248 | //Test create | ||
249 | Akonadi2::ApplicationDomain::Event event2; | ||
250 | { | ||
251 | QTRY_COMPARE(result.size(), 1); | ||
252 | auto value = result.first(); | ||
253 | QCOMPARE(value->getProperty("uid").toByteArray(), QByteArray("testuid")); | ||
254 | QCOMPARE(value->getProperty("summary").toByteArray(), QByteArray("summaryValue")); | ||
255 | event2 = *value; | ||
256 | } | ||
257 | |||
258 | event2.setProperty("uid", "testuid"); | ||
259 | event2.setProperty("summary", "summaryValue2"); | ||
260 | Akonadi2::Store::modify<Akonadi2::ApplicationDomain::Event>(event2, "org.kde.dummy.instance1").exec().waitForFinished(); | ||
261 | |||
262 | //Test modify | ||
263 | { | ||
264 | QTRY_COMPARE(result.size(), 1); | ||
265 | auto value = result.first(); | ||
266 | QCOMPARE(value->getProperty("uid").toByteArray(), QByteArray("testuid")); | ||
267 | QCOMPARE(value->getProperty("summary").toByteArray(), QByteArray("summaryValue2")); | ||
268 | } | ||
269 | |||
270 | Akonadi2::Store::remove<Akonadi2::ApplicationDomain::Event>(event2, "org.kde.dummy.instance1").exec().waitForFinished(); | ||
271 | |||
272 | //Test remove | ||
273 | { | ||
274 | QTRY_COMPARE(result.size(), 0); | ||
275 | } | ||
276 | } | ||
277 | |||
228 | }; | 278 | }; |
229 | 279 | ||
230 | QTEST_MAIN(DummyResourceTest) | 280 | QTEST_MAIN(DummyResourceTest) |