summaryrefslogtreecommitdiffstats
path: root/tests/maildirresourcetest.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2016-01-19 11:14:32 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2016-01-19 11:14:32 +0100
commit9e539844bb62fd8bcc4a8e423205ea4a15a1c15e (patch)
tree10507a8241af5025aa7898dcb568cd09140a4a84 /tests/maildirresourcetest.cpp
parente7ddc02bce5b4e46b44e3cb39c06ed25dc291c0a (diff)
downloadsink-9e539844bb62fd8bcc4a8e423205ea4a15a1c15e.tar.gz
sink-9e539844bb62fd8bcc4a8e423205ea4a15a1c15e.zip
Inspect unread state
Diffstat (limited to 'tests/maildirresourcetest.cpp')
-rw-r--r--tests/maildirresourcetest.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/tests/maildirresourcetest.cpp b/tests/maildirresourcetest.cpp
index c649536..046c920 100644
--- a/tests/maildirresourcetest.cpp
+++ b/tests/maildirresourcetest.cpp
@@ -353,14 +353,22 @@ private Q_SLOTS:
353 return Akonadi2::Store::modify(*mail); 353 return Akonadi2::Store::modify(*mail);
354 }) 354 })
355 .then<void>(Akonadi2::Store::flushMessageQueue(query.resources)) 355 .then<void>(Akonadi2::Store::flushMessageQueue(query.resources))
356 .then<void, KAsync::Job<void> >([folder]() -> KAsync::Job<void> { 356 .then<void, KAsync::Job<void> >([folder]() {
357 return Store::fetchAll<Mail>( 357 return Store::fetchAll<Mail>(
358 Query::PropertyFilter("folder", folder) + Query::RequestedProperties(QByteArrayList() << "folder" << "subject" << "unread") 358 Query::PropertyFilter("folder", folder) + Query::RequestedProperties(QByteArrayList() << "folder" << "subject" << "unread")
359 ) 359 )
360 .then<void, QList<Mail::Ptr> >([](const QList<Mail::Ptr> &mails) { 360 .then<void, KAsync::Job<void>, QList<Mail::Ptr>>([](const QList<Mail::Ptr> &mails) {
361 QCOMPARE(mails.size(), 1); 361 //Can't use QCOMPARE because it tries to return
362 if (mails.size() != 1) {
363 return KAsync::error<void>(1, "Wrong number of mails.");
364 }
362 auto mail = mails.first(); 365 auto mail = mails.first();
363 QCOMPARE(mail->getProperty("unread").toBool(), true); 366 //Can't use QCOMPARE because it tries to return
367 if (mail->getProperty("unread").toBool() != true) {
368 return KAsync::error<void>(1, "Wrong property value.");
369 }
370 auto inspectionCommand = Akonadi2::Resources::Inspection::PropertyInspection(*mail, "unread", true);
371 return Akonadi2::Resources::inspect<Mail>(inspectionCommand);
364 }) 372 })
365 .then<void>([](){}); 373 .then<void>([](){});
366 }); 374 });