diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-12-22 19:29:17 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-12-22 19:29:17 +0100 |
commit | a793c8d1c7a872db6152aa197c7a305f97644630 (patch) | |
tree | 350e6581c76218cf9e0a398d657b14745921cf59 /tests/maildirresourcetest.cpp | |
parent | 97c2e02697ba90d2339a905b7ad81aa883dca7a5 (diff) | |
download | sink-a793c8d1c7a872db6152aa197c7a305f97644630.tar.gz sink-a793c8d1c7a872db6152aa197c7a305f97644630.zip |
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.
Diffstat (limited to 'tests/maildirresourcetest.cpp')
-rw-r--r-- | tests/maildirresourcetest.cpp | 27 |
1 files changed, 23 insertions, 4 deletions
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: | |||
142 | 142 | ||
143 | Akonadi2::Query query; | 143 | Akonadi2::Query query; |
144 | query.resources << "org.kde.maildir.instance1"; | 144 | query.resources << "org.kde.maildir.instance1"; |
145 | query.requestedProperties << "folder" << "summary"; | 145 | query.requestedProperties << "folder" << "subject"; |
146 | query.propertyFilter.insert("folder", folderIdentifier); | 146 | query.propertyFilter.insert("folder", folderIdentifier); |
147 | auto mailModel = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Mail>(query); | 147 | auto mailModel = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Mail>(query); |
148 | QTRY_VERIFY(mailModel->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); | 148 | QTRY_VERIFY(mailModel->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); |
@@ -194,18 +194,37 @@ private Q_SLOTS: | |||
194 | QCOMPARE(model->match(model->index(0, 0, QModelIndex()), Qt::DisplayRole, QStringLiteral("newbox"), 1).size(), 1); | 194 | QCOMPARE(model->match(model->index(0, 0, QModelIndex()), Qt::DisplayRole, QStringLiteral("newbox"), 1).size(), 1); |
195 | } | 195 | } |
196 | 196 | ||
197 | void testSyncMailMove() | 197 | void testReSyncMail() |
198 | { | 198 | { |
199 | Akonadi2::Query query; | 199 | Akonadi2::Query query; |
200 | query.resources << "org.kde.maildir.instance1"; | 200 | query.resources << "org.kde.maildir.instance1"; |
201 | query.syncOnDemand = true; | 201 | query.syncOnDemand = true; |
202 | query.processAll = true; | 202 | query.processAll = true; |
203 | query.requestedProperties << "folder" << "summary"; | 203 | query.requestedProperties << "folder" << "subject"; |
204 | 204 | ||
205 | //Ensure all local data is processed | 205 | //Ensure all local data is processed |
206 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); | 206 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); |
207 | 207 | ||
208 | auto targetPath = tempDir.path() + QDir::separator() + "maildir1/cur/1365777830.R28.localhost.localdomain:2,S"; | 208 | //Ensure all local data is processed |
209 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); | ||
210 | |||
211 | auto mailModel = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Mail>(query); | ||
212 | QTRY_VERIFY(mailModel->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); | ||
213 | QCOMPARE(mailModel->rowCount(QModelIndex()), 2); | ||
214 | } | ||
215 | |||
216 | void testSyncMailRemoval() | ||
217 | { | ||
218 | Akonadi2::Query query; | ||
219 | query.resources << "org.kde.maildir.instance1"; | ||
220 | query.syncOnDemand = true; | ||
221 | query.processAll = true; | ||
222 | query.requestedProperties << "folder" << "subject"; | ||
223 | |||
224 | //Ensure all local data is processed | ||
225 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); | ||
226 | |||
227 | auto targetPath = tempDir.path() + "/maildir1/cur/1365777830.R28.localhost.localdomain:2,S"; | ||
209 | QFile file(targetPath); | 228 | QFile file(targetPath); |
210 | QVERIFY(file.remove()); | 229 | QVERIFY(file.remove()); |
211 | 230 | ||