summaryrefslogtreecommitdiffstats
path: root/tests/storagetest.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2015-11-30 18:49:04 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2015-11-30 18:49:04 +0100
commit412563b7ff18684f9786f4e40b1a4d538f2d5233 (patch)
tree3190a317306cfb71b0d5d9bc4c0f06b260a92ce6 /tests/storagetest.cpp
parent790991aa1007d3271d80bc7e77f5b4f86c9bcef0 (diff)
parent6ad307dd846d07f1b55a1679a8d2eb47525af57d (diff)
downloadsink-412563b7ff18684f9786f4e40b1a4d538f2d5233.tar.gz
sink-412563b7ff18684f9786f4e40b1a4d538f2d5233.zip
Merge branch 'feature/modelresult' into develop
Diffstat (limited to 'tests/storagetest.cpp')
-rw-r--r--tests/storagetest.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/storagetest.cpp b/tests/storagetest.cpp
index bef8755..d950961 100644
--- a/tests/storagetest.cpp
+++ b/tests/storagetest.cpp
@@ -376,6 +376,7 @@ private Q_SLOTS:
376 db.write("sub1","value1"); 376 db.write("sub1","value1");
377 db.write("sub2","value2"); 377 db.write("sub2","value2");
378 db.write("wub3","value3"); 378 db.write("wub3","value3");
379 db.write("wub4","value4");
379 QByteArray result; 380 QByteArray result;
380 db.findLatest("sub", [&](const QByteArray &key, const QByteArray &value) { 381 db.findLatest("sub", [&](const QByteArray &key, const QByteArray &value) {
381 result = value; 382 result = value;
@@ -384,6 +385,35 @@ private Q_SLOTS:
384 QCOMPARE(result, QByteArray("value2")); 385 QCOMPARE(result, QByteArray("value2"));
385 } 386 }
386 387
388 void testFindLatestInSingle()
389 {
390 Akonadi2::Storage store(testDataPath, dbName, Akonadi2::Storage::ReadWrite);
391 auto transaction = store.createTransaction(Akonadi2::Storage::ReadWrite);
392 auto db = transaction.openDatabase("test", nullptr, false);
393 db.write("sub2","value2");
394 QByteArray result;
395 db.findLatest("sub", [&](const QByteArray &key, const QByteArray &value) {
396 result = value;
397 });
398
399 QCOMPARE(result, QByteArray("value2"));
400 }
401
402 void testFindLast()
403 {
404 Akonadi2::Storage store(testDataPath, dbName, Akonadi2::Storage::ReadWrite);
405 auto transaction = store.createTransaction(Akonadi2::Storage::ReadWrite);
406 auto db = transaction.openDatabase("test", nullptr, false);
407 db.write("sub2","value2");
408 db.write("wub3","value3");
409 QByteArray result;
410 db.findLatest("wub", [&](const QByteArray &key, const QByteArray &value) {
411 result = value;
412 });
413
414 QCOMPARE(result, QByteArray("value3"));
415 }
416
387 void testRecordRevision() 417 void testRecordRevision()
388 { 418 {
389 Akonadi2::Storage store(testDataPath, dbName, Akonadi2::Storage::ReadWrite); 419 Akonadi2::Storage store(testDataPath, dbName, Akonadi2::Storage::ReadWrite);