summaryrefslogtreecommitdiffstats
path: root/tests/maildirresourcetest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/maildirresourcetest.cpp')
-rw-r--r--tests/maildirresourcetest.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/maildirresourcetest.cpp b/tests/maildirresourcetest.cpp
index e6b6849..a4856ce 100644
--- a/tests/maildirresourcetest.cpp
+++ b/tests/maildirresourcetest.cpp
@@ -149,6 +149,26 @@ private Q_SLOTS:
149 QVERIFY(mailModel->rowCount(QModelIndex()) >= 1); 149 QVERIFY(mailModel->rowCount(QModelIndex()) >= 1);
150 } 150 }
151 151
152 void testMailContent()
153 {
154 Akonadi2::Query query;
155 query.resources << "org.kde.maildir.instance1";
156 query.requestedProperties << "folder" << "subject" << "mimeMessage";
157 query.syncOnDemand = true;
158 query.processAll = true;
159
160 //Ensure all local data is processed
161 Akonadi2::Store::synchronize(query).exec().waitForFinished();
162
163 auto mailModel = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Mail>(query);
164 QTRY_VERIFY(mailModel->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool());
165 QVERIFY(mailModel->rowCount(QModelIndex()) >= 1);
166 auto mail = mailModel->index(0, 0, QModelIndex()).data(Akonadi2::Store::DomainObjectRole).value<Akonadi2::ApplicationDomain::Mail::Ptr>();
167 QVERIFY(!mail->getProperty("subject").toString().isEmpty());
168 QVERIFY(!mail->getProperty("mimeMessage").toString().isEmpty());
169 }
170
171
152 void testSyncFolderMove() 172 void testSyncFolderMove()
153 { 173 {
154 Akonadi2::Query query; 174 Akonadi2::Query query;
@@ -173,6 +193,29 @@ private Q_SLOTS:
173 QCOMPARE(model->match(model->index(0, 0, QModelIndex()), Qt::DisplayRole, QStringLiteral("newbox"), 1).size(), 1); 193 QCOMPARE(model->match(model->index(0, 0, QModelIndex()), Qt::DisplayRole, QStringLiteral("newbox"), 1).size(), 1);
174 } 194 }
175 195
196 void testSyncMailMove()
197 {
198 Akonadi2::Query query;
199 query.resources << "org.kde.maildir.instance1";
200 query.syncOnDemand = true;
201 query.processAll = true;
202 query.requestedProperties << "folder" << "summary";
203
204 //Ensure all local data is processed
205 Akonadi2::Store::synchronize(query).exec().waitForFinished();
206
207 auto targetPath = tempDir.path() + QDir::separator() + "maildir1/cur/1365777830.R28.localhost.localdomain:2,S";
208 QFile file(targetPath);
209 QVERIFY(file.remove());
210
211 //Ensure all local data is processed
212 Akonadi2::Store::synchronize(query).exec().waitForFinished();
213
214 auto mailModel = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Mail>(query);
215 QTRY_VERIFY(mailModel->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool());
216 QCOMPARE(mailModel->rowCount(QModelIndex()), 1);
217 }
218
176}; 219};
177 220
178QTEST_MAIN(MaildirResourceTest) 221QTEST_MAIN(MaildirResourceTest)