From 4922555a38af32fc94e56aeb208b9fda31dab1b2 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Tue, 19 Jan 2016 12:19:39 +0100 Subject: Cleanup --- tests/maildirresourcetest.cpp | 38 +++++++++++--------------------------- 1 file changed, 11 insertions(+), 27 deletions(-) (limited to 'tests') diff --git a/tests/maildirresourcetest.cpp b/tests/maildirresourcetest.cpp index 8952ff2..146489d 100644 --- a/tests/maildirresourcetest.cpp +++ b/tests/maildirresourcetest.cpp @@ -320,10 +320,9 @@ private Q_SLOTS: } auto mail = mails.first(); - auto inspectionCommand = Akonadi2::Resources::Inspection::ExistenceInspection(*mail, true); return Store::remove(*mail) .then(Store::flushMessageQueue(query.resources)) //The change needs to be replayed already - .then(Resources::inspect(inspectionCommand)); + .then(Resources::inspect(Resources::Inspection::ExistenceInspection(*mail, false))); }) .then([](){}); }) @@ -338,45 +337,30 @@ private Q_SLOTS: using namespace Akonadi2::ApplicationDomain; auto query = Query::ResourceFilter("org.kde.maildir.instance1"); - Akonadi2::Store::synchronize(query).exec().waitForFinished(); - Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); + Store::synchronize(query).exec().waitForFinished(); + Store::flushMessageQueue(query.resources).exec().waitForFinished(); auto result = Store::fetchOne( Query::ResourceFilter("org.kde.maildir.instance1") + Query::PropertyFilter("name", "maildir1") + Query::RequestedProperties(QByteArrayList() << "name") ) .then, Folder>([query](const Folder &folder) { + Trace() << "Found a folder" << folder.identifier(); return Store::fetchAll( Query::PropertyFilter("folder", folder) + Query::RequestedProperties(QByteArrayList() << "folder" << "subject") ) - .then, QList >([](const QList &mails) -> KAsync::Job { - //Can't use QCOMPARE because it tries to return + .then, QList >([query](const QList &mails) { + //Can't use QCOMPARE because it tries to return FIXME Implement ASYNCCOMPARE if (mails.size() != 1) { return KAsync::error(1, "Wrong number of mails."); } auto mail = mails.first(); mail->setProperty("unread", true); - return Akonadi2::Store::modify(*mail); + auto inspectionCommand = Resources::Inspection::PropertyInspection(*mail, "unread", true); + return Store::modify(*mail) + .then(Store::flushMessageQueue(query.resources)) //The change needs to be replayed already + .then(Resources::inspect(inspectionCommand)); }) - .then(Akonadi2::Store::flushMessageQueue(query.resources)) - .then >([folder]() { - return Store::fetchAll( - Query::PropertyFilter("folder", folder) + Query::RequestedProperties(QByteArrayList() << "folder" << "subject" << "unread") - ) - .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(); - //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([](){}); - }); + .then([](){}); }) .exec(); result.waitForFinished(); -- cgit v1.2.3