From 9e539844bb62fd8bcc4a8e423205ea4a15a1c15e Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Tue, 19 Jan 2016 11:14:32 +0100 Subject: Inspect unread state --- tests/maildirresourcetest.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'tests') 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: return Akonadi2::Store::modify(*mail); }) .then(Akonadi2::Store::flushMessageQueue(query.resources)) - .then >([folder]() -> KAsync::Job { + .then >([folder]() { return Store::fetchAll( Query::PropertyFilter("folder", folder) + Query::RequestedProperties(QByteArrayList() << "folder" << "subject" << "unread") ) - .then >([](const QList &mails) { - QCOMPARE(mails.size(), 1); + .then, QList>([](const QList &mails) { + //Can't use QCOMPARE because it tries to return + if (mails.size() != 1) { + return KAsync::error(1, "Wrong number of mails."); + } auto mail = mails.first(); - QCOMPARE(mail->getProperty("unread").toBool(), true); + //Can't use QCOMPARE because it tries to return + if (mail->getProperty("unread").toBool() != true) { + return KAsync::error(1, "Wrong property value."); + } + auto inspectionCommand = Akonadi2::Resources::Inspection::PropertyInspection(*mail, "unread", true); + return Akonadi2::Resources::inspect(inspectionCommand); }) .then([](){}); }); -- cgit v1.2.3