diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/maildirresourcetest.cpp | 48 | ||||
-rw-r--r-- | tests/mailtest.cpp | 3 |
2 files changed, 3 insertions, 48 deletions
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: | |||
245 | QCOMPARE(mailModel->rowCount(QModelIndex()), 2); | 245 | QCOMPARE(mailModel->rowCount(QModelIndex()), 2); |
246 | } | 246 | } |
247 | 247 | ||
248 | void testCreateFolder() | ||
249 | { | ||
250 | Sink::Query query; | ||
251 | query.resources << "org.kde.maildir.instance1"; | ||
252 | |||
253 | // Ensure all local data is processed | ||
254 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); | ||
255 | |||
256 | Sink::ApplicationDomain::Folder folder("org.kde.maildir.instance1"); | ||
257 | folder.setProperty("name", "testCreateFolder"); | ||
258 | |||
259 | Sink::Store::create(folder).exec().waitForFinished(); | ||
260 | |||
261 | // Ensure all local data is processed | ||
262 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); | ||
263 | |||
264 | auto targetPath = tempDir.path() + "/maildir1/testCreateFolder"; | ||
265 | QFileInfo file(targetPath); | ||
266 | QTRY_VERIFY(file.exists()); | ||
267 | QVERIFY(file.isDir()); | ||
268 | } | ||
269 | |||
270 | void testRemoveFolder() | ||
271 | { | ||
272 | Sink::Query query; | ||
273 | query.resources << "org.kde.maildir.instance1"; | ||
274 | |||
275 | auto targetPath = tempDir.path() + "/maildir1/testCreateFolder"; | ||
276 | |||
277 | Sink::ApplicationDomain::Folder folder("org.kde.maildir.instance1"); | ||
278 | folder.setProperty("name", "testCreateFolder"); | ||
279 | Sink::Store::create(folder).exec().waitForFinished(); | ||
280 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); | ||
281 | QTRY_VERIFY(QFileInfo(targetPath).exists()); | ||
282 | |||
283 | Sink::Query folderQuery; | ||
284 | folderQuery.resources << "org.kde.maildir.instance1"; | ||
285 | folderQuery += Sink::Query::PropertyFilter("name", "testCreateFolder"); | ||
286 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Folder>(folderQuery); | ||
287 | QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); | ||
288 | QCOMPARE(model->rowCount(QModelIndex()), 1); | ||
289 | auto createdFolder = model->index(0, 0, QModelIndex()).data(Sink::Store::DomainObjectRole).value<Sink::ApplicationDomain::Folder::Ptr>(); | ||
290 | |||
291 | Sink::Store::remove(*createdFolder).exec().waitForFinished(); | ||
292 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); | ||
293 | QTRY_VERIFY(!QFileInfo(targetPath).exists()); | ||
294 | } | ||
295 | |||
296 | }; | 248 | }; |
297 | 249 | ||
298 | QTEST_MAIN(MaildirResourceTest) | 250 | 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() | |||
95 | }); | 95 | }); |
96 | VERIFYEXEC(job); | 96 | VERIFYEXEC(job); |
97 | } | 97 | } |
98 | VERIFYEXEC(ResourceControl::inspect<ApplicationDomain::Folder>(ResourceControl::Inspection::ExistenceInspection(folder, true))); | ||
98 | 99 | ||
99 | QString name2 = "name2"; | 100 | QString name2 = "name2"; |
100 | QByteArray icon2 = "icon2"; | 101 | QByteArray icon2 = "icon2"; |
@@ -118,6 +119,7 @@ void MailTest::testCreateModifyDeleteFolder() | |||
118 | }); | 119 | }); |
119 | VERIFYEXEC(job); | 120 | VERIFYEXEC(job); |
120 | } | 121 | } |
122 | VERIFYEXEC(ResourceControl::inspect<ApplicationDomain::Folder>(ResourceControl::Inspection::ExistenceInspection(folder, true))); | ||
121 | 123 | ||
122 | VERIFYEXEC(Store::remove(folder)); | 124 | VERIFYEXEC(Store::remove(folder)); |
123 | VERIFYEXEC(ResourceControl::flushMessageQueue(QByteArrayList() << mResourceInstanceIdentifier)); | 125 | VERIFYEXEC(ResourceControl::flushMessageQueue(QByteArrayList() << mResourceInstanceIdentifier)); |
@@ -128,6 +130,7 @@ void MailTest::testCreateModifyDeleteFolder() | |||
128 | }); | 130 | }); |
129 | VERIFYEXEC(job); | 131 | VERIFYEXEC(job); |
130 | } | 132 | } |
133 | VERIFYEXEC(ResourceControl::inspect<ApplicationDomain::Folder>(ResourceControl::Inspection::ExistenceInspection(folder, false))); | ||
131 | } | 134 | } |
132 | 135 | ||
133 | void MailTest::testCreateModifyDeleteMail() | 136 | void MailTest::testCreateModifyDeleteMail() |