diff options
Diffstat (limited to 'tests/mailsynctest.cpp')
-rw-r--r-- | tests/mailsynctest.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/mailsynctest.cpp b/tests/mailsynctest.cpp index 7edda32..3927f14 100644 --- a/tests/mailsynctest.cpp +++ b/tests/mailsynctest.cpp | |||
@@ -377,6 +377,31 @@ void MailSyncTest::testFlagChange() | |||
377 | 377 | ||
378 | } | 378 | } |
379 | 379 | ||
380 | void MailSyncTest::testSyncSingleFolder() | ||
381 | { | ||
382 | VERIFYEXEC(Store::synchronize(Sink::SyncScope{ApplicationDomain::getTypeName<Folder>()}.resourceFilter(mResourceInstanceIdentifier))); | ||
383 | VERIFYEXEC(ResourceControl::flushMessageQueue(mResourceInstanceIdentifier)); | ||
384 | |||
385 | Folder::Ptr folder; | ||
386 | { | ||
387 | auto job = Store::fetchAll<Folder>(Sink::Query{}.resourceFilter(mResourceInstanceIdentifier).filter<Folder::Name>("test")).template syncThen<void, QList<Folder::Ptr>>([&](const QList<Folder::Ptr> &folders) { | ||
388 | QCOMPARE(folders.size(), 1); | ||
389 | folder = folders.first(); | ||
390 | }); | ||
391 | VERIFYEXEC(job); | ||
392 | } | ||
393 | |||
394 | auto syncScope = Sink::SyncScope{ApplicationDomain::getTypeName<Mail>()}; | ||
395 | syncScope.resourceFilter(mResourceInstanceIdentifier); | ||
396 | syncScope.filter<Mail::Folder>(QVariant::fromValue(folder->identifier())); | ||
397 | |||
398 | // Ensure all local data is processed | ||
399 | VERIFYEXEC(Store::synchronize(syncScope)); | ||
400 | VERIFYEXEC(ResourceControl::flushMessageQueue(mResourceInstanceIdentifier)); | ||
401 | |||
402 | |||
403 | } | ||
404 | |||
380 | void MailSyncTest::testFailingSync() | 405 | void MailSyncTest::testFailingSync() |
381 | { | 406 | { |
382 | auto resource = createFaultyResource(); | 407 | auto resource = createFaultyResource(); |