summaryrefslogtreecommitdiffstats
path: root/tests/mailthreadtest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/mailthreadtest.cpp')
-rw-r--r--tests/mailthreadtest.cpp28
1 files changed, 25 insertions, 3 deletions
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()
133 query.sort<Mail::Date>(); 133 query.sort<Mail::Date>();
134 query.filter<Mail::Folder>(folder); 134 query.filter<Mail::Folder>(folder);
135 135
136 Mail threadLeader;
137
138 //Ensure we find the thread leader
139 {
140 auto job = Store::fetchAll<Mail>(query)
141 .syncThen<void, QList<Mail::Ptr>>([=, &threadLeader](const QList<Mail::Ptr> &mails) {
142 QCOMPARE(mails.size(), 1);
143 auto mail = *mails.first();
144 threadLeader = mail;
145 QCOMPARE(mail.getSubject(), QString::fromLatin1("Re: Re: 1"));
146 });
147 VERIFYEXEC(job);
148 }
149
150 //Ensure we find the thread leader still
136 { 151 {
137 auto job = Store::fetchAll<Mail>(query) 152 auto job = Store::fetchAll<Mail>(query)
138 .syncThen<void, QList<Mail::Ptr>>([=](const QList<Mail::Ptr> &mails) { 153 .syncThen<void, QList<Mail::Ptr>>([=](const QList<Mail::Ptr> &mails) {
@@ -149,17 +164,24 @@ void MailThreadTest::testIndexInMixedOrder()
149 mail.setFolder(folder); 164 mail.setFolder(folder);
150 VERIFYEXEC(Store::create(mail)); 165 VERIFYEXEC(Store::create(mail));
151 } 166 }
152
153 VERIFYEXEC(ResourceControl::flushMessageQueue(QByteArrayList() << mResourceInstanceIdentifier)); 167 VERIFYEXEC(ResourceControl::flushMessageQueue(QByteArrayList() << mResourceInstanceIdentifier));
168
169 //Ensure the thread is complete
154 { 170 {
171 Sink::Query query;
172 query.resources << mResourceInstanceIdentifier;
173 query.request<Mail::Subject>().request<Mail::MimeMessage>().request<Mail::Folder>().request<Mail::Date>();
174 query.bloomThread = true;
175 query.sort<Mail::Date>();
176 query.ids << threadLeader.identifier();
177
155 auto job = Store::fetchAll<Mail>(query) 178 auto job = Store::fetchAll<Mail>(query)
156 .syncThen<void, QList<Mail::Ptr>>([=](const QList<Mail::Ptr> &mails) { 179 .syncThen<void, QList<Mail::Ptr>>([=](const QList<Mail::Ptr> &mails) {
157 QCOMPARE(mails.size(), 1); 180 QCOMPARE(mails.size(), 2);
158 auto mail = *mails.first(); 181 auto mail = *mails.first();
159 QCOMPARE(mail.getSubject(), QString::fromLatin1("Re: Re: 1")); 182 QCOMPARE(mail.getSubject(), QString::fromLatin1("Re: Re: 1"));
160 }); 183 });
161 VERIFYEXEC(job); 184 VERIFYEXEC(job);
162 //TODO ensure we also find message 1 as part of thread.
163 } 185 }
164 186
165 /* VERIFYEXEC(Store::remove(mail)); */ 187 /* VERIFYEXEC(Store::remove(mail)); */