diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-07-19 20:18:14 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-07-19 20:25:29 +0200 |
commit | a908ea3ecb5ad78e4bdadf13d40ff76d0a038b76 (patch) | |
tree | 3d3d6d503ca12b6eb13fe6158502859a57d3669d /tests/dummyresourcetest.cpp | |
parent | c563ee72f25c42a1c6f492c5f2d4e56c2c91df2a (diff) | |
download | sink-a908ea3ecb5ad78e4bdadf13d40ff76d0a038b76.tar.gz sink-a908ea3ecb5ad78e4bdadf13d40ff76d0a038b76.zip |
Modify/Delete actions
Diffstat (limited to 'tests/dummyresourcetest.cpp')
-rw-r--r-- | tests/dummyresourcetest.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/dummyresourcetest.cpp b/tests/dummyresourcetest.cpp index 49558f8..7499d62 100644 --- a/tests/dummyresourcetest.cpp +++ b/tests/dummyresourcetest.cpp | |||
@@ -208,6 +208,47 @@ private Q_SLOTS: | |||
208 | qDebug() << value->getProperty("summary").toString(); | 208 | qDebug() << value->getProperty("summary").toString(); |
209 | } | 209 | } |
210 | 210 | ||
211 | void testWriteModifyDelete() | ||
212 | { | ||
213 | Akonadi2::ApplicationDomain::Event event; | ||
214 | event.setProperty("uid", "testuid"); | ||
215 | QCOMPARE(event.getProperty("uid").toByteArray(), QByteArray("testuid")); | ||
216 | event.setProperty("summary", "summaryValue"); | ||
217 | Akonadi2::Store::create<Akonadi2::ApplicationDomain::Event>(event, "org.kde.dummy.instance1"); | ||
218 | |||
219 | Akonadi2::Query query; | ||
220 | query.resources << "org.kde.dummy.instance1"; | ||
221 | query.syncOnDemand = false; | ||
222 | query.processAll = true; | ||
223 | query.propertyFilter.insert("uid", "testuid"); | ||
224 | |||
225 | //Test create | ||
226 | Akonadi2::ApplicationDomain::Event event2; | ||
227 | { | ||
228 | async::SyncListResult<Akonadi2::ApplicationDomain::Event::Ptr> result(Akonadi2::Store::load<Akonadi2::ApplicationDomain::Event>(query)); | ||
229 | result.exec(); | ||
230 | QCOMPARE(result.size(), 1); | ||
231 | auto value = result.first(); | ||
232 | QCOMPARE(value->getProperty("uid").toByteArray(), QByteArray("testuid")); | ||
233 | QCOMPARE(value->getProperty("summary").toByteArray(), QByteArray("summaryValue")); | ||
234 | event2 = *value; | ||
235 | } | ||
236 | |||
237 | event2.setProperty("uid", "testuid"); | ||
238 | event2.setProperty("summary", "summaryValue2"); | ||
239 | Akonadi2::Store::modify<Akonadi2::ApplicationDomain::Event>(event2, "org.kde.dummy.instance1"); | ||
240 | |||
241 | //Test modify | ||
242 | { | ||
243 | async::SyncListResult<Akonadi2::ApplicationDomain::Event::Ptr> result(Akonadi2::Store::load<Akonadi2::ApplicationDomain::Event>(query)); | ||
244 | result.exec(); | ||
245 | QCOMPARE(result.size(), 1); | ||
246 | auto value = result.first(); | ||
247 | QCOMPARE(value->getProperty("uid").toByteArray(), QByteArray("testuid")); | ||
248 | QCOMPARE(value->getProperty("summary").toByteArray(), QByteArray("summaryValue2")); | ||
249 | } | ||
250 | } | ||
251 | |||
211 | }; | 252 | }; |
212 | 253 | ||
213 | QTEST_MAIN(DummyResourceTest) | 254 | QTEST_MAIN(DummyResourceTest) |