diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-12-18 10:38:36 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-12-18 10:38:36 +0100 |
commit | 23e807c133a23f924d56bc860aa34f62f09109ff (patch) | |
tree | 92d8584902d1cc902c8a1b8d7464427035257ccf /tests/maildirresourcetest.cpp | |
parent | 765f27cf52497bc401579db38f0011d90fb75cbb (diff) | |
download | sink-23e807c133a23f924d56bc860aa34f62f09109ff.tar.gz sink-23e807c133a23f924d56bc860aa34f62f09109ff.zip |
Detect modifications and removals on folders in the maildirresource
Diffstat (limited to 'tests/maildirresourcetest.cpp')
-rw-r--r-- | tests/maildirresourcetest.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/maildirresourcetest.cpp b/tests/maildirresourcetest.cpp index d279a36..e6b6849 100644 --- a/tests/maildirresourcetest.cpp +++ b/tests/maildirresourcetest.cpp | |||
@@ -149,6 +149,30 @@ private Q_SLOTS: | |||
149 | QVERIFY(mailModel->rowCount(QModelIndex()) >= 1); | 149 | QVERIFY(mailModel->rowCount(QModelIndex()) >= 1); |
150 | } | 150 | } |
151 | 151 | ||
152 | void testSyncFolderMove() | ||
153 | { | ||
154 | Akonadi2::Query query; | ||
155 | query.resources << "org.kde.maildir.instance1"; | ||
156 | query.syncOnDemand = true; | ||
157 | query.processAll = true; | ||
158 | query.requestedProperties << "name"; | ||
159 | |||
160 | //Ensure all local data is processed | ||
161 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); | ||
162 | |||
163 | auto targetPath = tempDir.path() + QDir::separator() + "maildir1/"; | ||
164 | QDir dir(targetPath); | ||
165 | QVERIFY(dir.rename("inbox", "newbox")); | ||
166 | |||
167 | //Ensure all local data is processed | ||
168 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); | ||
169 | |||
170 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Folder>(query); | ||
171 | QTRY_VERIFY(model->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); | ||
172 | QCOMPARE(model->rowCount(QModelIndex()), 2); | ||
173 | QCOMPARE(model->match(model->index(0, 0, QModelIndex()), Qt::DisplayRole, QStringLiteral("newbox"), 1).size(), 1); | ||
174 | } | ||
175 | |||
152 | }; | 176 | }; |
153 | 177 | ||
154 | QTEST_MAIN(MaildirResourceTest) | 178 | QTEST_MAIN(MaildirResourceTest) |