From 7ed3ecd282516296bbc7e4a2a24d1e3266bd8601 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Wed, 25 May 2016 10:21:36 +0200 Subject: Maildir folder inspection --- tests/maildirresourcetest.cpp | 48 ------------------------------------------- tests/mailtest.cpp | 3 +++ 2 files changed, 3 insertions(+), 48 deletions(-) (limited to 'tests') diff --git a/tests/maildirresourcetest.cpp b/tests/maildirresourcetest.cpp index 46d2a28..0a32000 100644 --- a/tests/maildirresourcetest.cpp +++ b/tests/maildirresourcetest.cpp @@ -245,54 +245,6 @@ private slots: QCOMPARE(mailModel->rowCount(QModelIndex()), 2); } - void testCreateFolder() - { - Sink::Query query; - query.resources << "org.kde.maildir.instance1"; - - // Ensure all local data is processed - Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); - - Sink::ApplicationDomain::Folder folder("org.kde.maildir.instance1"); - folder.setProperty("name", "testCreateFolder"); - - Sink::Store::create(folder).exec().waitForFinished(); - - // Ensure all local data is processed - Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); - - auto targetPath = tempDir.path() + "/maildir1/testCreateFolder"; - QFileInfo file(targetPath); - QTRY_VERIFY(file.exists()); - QVERIFY(file.isDir()); - } - - void testRemoveFolder() - { - Sink::Query query; - query.resources << "org.kde.maildir.instance1"; - - auto targetPath = tempDir.path() + "/maildir1/testCreateFolder"; - - Sink::ApplicationDomain::Folder folder("org.kde.maildir.instance1"); - folder.setProperty("name", "testCreateFolder"); - Sink::Store::create(folder).exec().waitForFinished(); - Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); - QTRY_VERIFY(QFileInfo(targetPath).exists()); - - Sink::Query folderQuery; - folderQuery.resources << "org.kde.maildir.instance1"; - folderQuery += Sink::Query::PropertyFilter("name", "testCreateFolder"); - auto model = Sink::Store::loadModel(folderQuery); - QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); - QCOMPARE(model->rowCount(QModelIndex()), 1); - auto createdFolder = model->index(0, 0, QModelIndex()).data(Sink::Store::DomainObjectRole).value(); - - Sink::Store::remove(*createdFolder).exec().waitForFinished(); - Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); - QTRY_VERIFY(!QFileInfo(targetPath).exists()); - } - }; QTEST_MAIN(MaildirResourceTest) diff --git a/tests/mailtest.cpp b/tests/mailtest.cpp index e47c3eb..532896b 100644 --- a/tests/mailtest.cpp +++ b/tests/mailtest.cpp @@ -95,6 +95,7 @@ void MailTest::testCreateModifyDeleteFolder() }); VERIFYEXEC(job); } + VERIFYEXEC(ResourceControl::inspect(ResourceControl::Inspection::ExistenceInspection(folder, true))); QString name2 = "name2"; QByteArray icon2 = "icon2"; @@ -118,6 +119,7 @@ void MailTest::testCreateModifyDeleteFolder() }); VERIFYEXEC(job); } + VERIFYEXEC(ResourceControl::inspect(ResourceControl::Inspection::ExistenceInspection(folder, true))); VERIFYEXEC(Store::remove(folder)); VERIFYEXEC(ResourceControl::flushMessageQueue(QByteArrayList() << mResourceInstanceIdentifier)); @@ -128,6 +130,7 @@ void MailTest::testCreateModifyDeleteFolder() }); VERIFYEXEC(job); } + VERIFYEXEC(ResourceControl::inspect(ResourceControl::Inspection::ExistenceInspection(folder, false))); } void MailTest::testCreateModifyDeleteMail() -- cgit v1.2.3