From 47b9f2109f57c1121b760ea6d885ab08f12c46b3 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Mon, 26 Sep 2016 14:19:44 +0200 Subject: Blooming --- tests/mailthreadtest.cpp | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/mailthreadtest.cpp b/tests/mailthreadtest.cpp index a3df56b..89e5a85 100644 --- a/tests/mailthreadtest.cpp +++ b/tests/mailthreadtest.cpp @@ -133,6 +133,21 @@ void MailThreadTest::testIndexInMixedOrder() query.sort(); query.filter(folder); + Mail threadLeader; + + //Ensure we find the thread leader + { + auto job = Store::fetchAll(query) + .syncThen>([=, &threadLeader](const QList &mails) { + QCOMPARE(mails.size(), 1); + auto mail = *mails.first(); + threadLeader = mail; + QCOMPARE(mail.getSubject(), QString::fromLatin1("Re: Re: 1")); + }); + VERIFYEXEC(job); + } + + //Ensure we find the thread leader still { auto job = Store::fetchAll(query) .syncThen>([=](const QList &mails) { @@ -149,17 +164,24 @@ void MailThreadTest::testIndexInMixedOrder() mail.setFolder(folder); VERIFYEXEC(Store::create(mail)); } - VERIFYEXEC(ResourceControl::flushMessageQueue(QByteArrayList() << mResourceInstanceIdentifier)); + + //Ensure the thread is complete { + Sink::Query query; + query.resources << mResourceInstanceIdentifier; + query.request().request().request().request(); + query.bloomThread = true; + query.sort(); + query.ids << threadLeader.identifier(); + auto job = Store::fetchAll(query) .syncThen>([=](const QList &mails) { - QCOMPARE(mails.size(), 1); + QCOMPARE(mails.size(), 2); auto mail = *mails.first(); QCOMPARE(mail.getSubject(), QString::fromLatin1("Re: Re: 1")); }); VERIFYEXEC(job); - //TODO ensure we also find message 1 as part of thread. } /* VERIFYEXEC(Store::remove(mail)); */ -- cgit v1.2.3