From e3f5df951b4ed711224ac950f1669b91880273f8 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Mon, 14 Nov 2016 10:01:20 +0100 Subject: Sync single folder test --- tests/mailsynctest.cpp | 25 +++++++++++++++++++++++++ tests/mailsynctest.h | 2 ++ 2 files changed, 27 insertions(+) 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() } +void MailSyncTest::testSyncSingleFolder() +{ + VERIFYEXEC(Store::synchronize(Sink::SyncScope{ApplicationDomain::getTypeName()}.resourceFilter(mResourceInstanceIdentifier))); + VERIFYEXEC(ResourceControl::flushMessageQueue(mResourceInstanceIdentifier)); + + Folder::Ptr folder; + { + auto job = Store::fetchAll(Sink::Query{}.resourceFilter(mResourceInstanceIdentifier).filter("test")).template syncThen>([&](const QList &folders) { + QCOMPARE(folders.size(), 1); + folder = folders.first(); + }); + VERIFYEXEC(job); + } + + auto syncScope = Sink::SyncScope{ApplicationDomain::getTypeName()}; + syncScope.resourceFilter(mResourceInstanceIdentifier); + syncScope.filter(QVariant::fromValue(folder->identifier())); + + // Ensure all local data is processed + VERIFYEXEC(Store::synchronize(syncScope)); + VERIFYEXEC(ResourceControl::flushMessageQueue(mResourceInstanceIdentifier)); + + +} + void MailSyncTest::testFailingSync() { auto resource = createFaultyResource(); diff --git a/tests/mailsynctest.h b/tests/mailsynctest.h index 94643f6..8ad3bb3 100644 --- a/tests/mailsynctest.h +++ b/tests/mailsynctest.h @@ -69,6 +69,8 @@ private slots: void testFetchNewRemovedMessages(); void testFlagChange(); + void testSyncSingleFolder(); + void testFailingSync(); }; -- cgit v1.2.3