diff options
Diffstat (limited to 'tests/test_notmuchworker.cpp')
| -rw-r--r-- | tests/test_notmuchworker.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/test_notmuchworker.cpp b/tests/test_notmuchworker.cpp index 9068ca3..f8dfe91 100644 --- a/tests/test_notmuchworker.cpp +++ b/tests/test_notmuchworker.cpp @@ -62,6 +62,7 @@ private slots: void loadMessageReturnsOnlyThatMessage(); void loadMessageOnAnUnknownIdReturnsNothing(); + void aQueryCarriesEachThreadsFirstMessageId(); void loadThreadTreeReportsReplyDepth(); void loadThreadTreeCarriesTheFactsARowNeeds(); @@ -241,6 +242,37 @@ void TestNotmuchWorker::loadMessageOnAnUnknownIdReturnsNothing() QCOMPARE(errors.count(), 0); } +void TestNotmuchWorker::aQueryCarriesEachThreadsFirstMessageId() +{ + // The root card IS the thread's first message, so selecting it must be + // able to load that message. Before this the id was known only after the + // thread had been EXPANDED, so a first click on an unexpanded root fell + // back to rendering the whole conversation, and the same click behaved + // differently once the thread had been opened. That inconsistency is what + // the user reported as item 66. + // + // Free to collect: measured against a real 36,615-thread database, a walk + // with this and a walk without are indistinguishable, because + // notmuch_thread_get_toplevel_messages reads the index rather than the + // message files. Contrast ThreadSummary::recipients, which reads every + // file and is Sent-only for that reason. + const QVector<ThreadSummary> threads = runQuery(QStringLiteral("*")); + QVERIFY(!threads.isEmpty()); + + bool sawTheThread = false; + for (const ThreadSummary &t : threads) { + QVERIFY2(!t.firstMessageId.isEmpty(), + qPrintable(QStringLiteral("thread %1 carries no first message") + .arg(t.subject))); + if (t.subject == QStringLiteral("Release notes")) { + // a1 is the root, a2 its reply. The FIRST message, not the newest. + QCOMPARE(t.firstMessageId, QStringLiteral("a1@example.org")); + sawTheThread = true; + } + } + QVERIFY2(sawTheThread, "the two-message thread was not in the results"); +} + void TestNotmuchWorker::loadThreadTreeReportsReplyDepth() { // Thread A is a root plus one reply carrying In-Reply-To, which is what |
