From a793c8d1c7a872db6152aa197c7a305f97644630 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Tue, 22 Dec 2015 19:29:17 +0100 Subject: Use the folder index for syncing mails. If we iterate over all mails, all mails that are not in the current folder will not be existing in exists(). If we use the index instead to only get to the mails we need we're in a better situation. --- tests/maildirresourcetest.cpp | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/maildirresourcetest.cpp b/tests/maildirresourcetest.cpp index b16f883..51ea278 100644 --- a/tests/maildirresourcetest.cpp +++ b/tests/maildirresourcetest.cpp @@ -142,7 +142,7 @@ private Q_SLOTS: Akonadi2::Query query; query.resources << "org.kde.maildir.instance1"; - query.requestedProperties << "folder" << "summary"; + query.requestedProperties << "folder" << "subject"; query.propertyFilter.insert("folder", folderIdentifier); auto mailModel = Akonadi2::Store::loadModel(query); QTRY_VERIFY(mailModel->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); @@ -194,18 +194,37 @@ private Q_SLOTS: QCOMPARE(model->match(model->index(0, 0, QModelIndex()), Qt::DisplayRole, QStringLiteral("newbox"), 1).size(), 1); } - void testSyncMailMove() + void testReSyncMail() { Akonadi2::Query query; query.resources << "org.kde.maildir.instance1"; query.syncOnDemand = true; query.processAll = true; - query.requestedProperties << "folder" << "summary"; + query.requestedProperties << "folder" << "subject"; //Ensure all local data is processed Akonadi2::Store::synchronize(query).exec().waitForFinished(); - auto targetPath = tempDir.path() + QDir::separator() + "maildir1/cur/1365777830.R28.localhost.localdomain:2,S"; + //Ensure all local data is processed + Akonadi2::Store::synchronize(query).exec().waitForFinished(); + + auto mailModel = Akonadi2::Store::loadModel(query); + QTRY_VERIFY(mailModel->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); + QCOMPARE(mailModel->rowCount(QModelIndex()), 2); + } + + void testSyncMailRemoval() + { + Akonadi2::Query query; + query.resources << "org.kde.maildir.instance1"; + query.syncOnDemand = true; + query.processAll = true; + query.requestedProperties << "folder" << "subject"; + + //Ensure all local data is processed + Akonadi2::Store::synchronize(query).exec().waitForFinished(); + + auto targetPath = tempDir.path() + "/maildir1/cur/1365777830.R28.localhost.localdomain:2,S"; QFile file(targetPath); QVERIFY(file.remove()); -- cgit v1.2.3