From 23e807c133a23f924d56bc860aa34f62f09109ff Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Fri, 18 Dec 2015 10:38:36 +0100 Subject: Detect modifications and removals on folders in the maildirresource --- tests/maildirresourcetest.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'tests') 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: QVERIFY(mailModel->rowCount(QModelIndex()) >= 1); } + void testSyncFolderMove() + { + Akonadi2::Query query; + query.resources << "org.kde.maildir.instance1"; + query.syncOnDemand = true; + query.processAll = true; + query.requestedProperties << "name"; + + //Ensure all local data is processed + Akonadi2::Store::synchronize(query).exec().waitForFinished(); + + auto targetPath = tempDir.path() + QDir::separator() + "maildir1/"; + QDir dir(targetPath); + QVERIFY(dir.rename("inbox", "newbox")); + + //Ensure all local data is processed + Akonadi2::Store::synchronize(query).exec().waitForFinished(); + + auto model = Akonadi2::Store::loadModel(query); + QTRY_VERIFY(model->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); + QCOMPARE(model->rowCount(QModelIndex()), 2); + QCOMPARE(model->match(model->index(0, 0, QModelIndex()), Qt::DisplayRole, QStringLiteral("newbox"), 1).size(), 1); + } + }; QTEST_MAIN(MaildirResourceTest) -- cgit v1.2.3