From ca5b6ca711e73bc22fdf108e06d82241e059c6ee Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Wed, 26 Aug 2026 15:55:13 +0200 Subject: feat: expose a row's sender to the delegate --- tests/test_threadlistmodel.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'tests') diff --git a/tests/test_threadlistmodel.cpp b/tests/test_threadlistmodel.cpp index 593a777..25c89b0 100644 --- a/tests/test_threadlistmodel.cpp +++ b/tests/test_threadlistmodel.cpp @@ -102,6 +102,7 @@ private slots: void flatModeOffersNoExpanderAndNoReplyCount(); void flatModeIsOffByDefaultAndReversible(); void recipientsReplaceTheSenderWhenPresent(); + void aRowCarriesItsSenderAndAccountAddress(); }; static ThreadSummary makeThread(const QString &id, const QString &subject) @@ -510,6 +511,28 @@ void TestThreadListModel::reportsSubjectAndAuthors() QStringList({ QStringLiteral("inbox"), QStringLiteral("unread") })); } +void TestThreadListModel::aRowCarriesItsSenderAndAccountAddress() +{ + // Task 8: the avatar needs the row's bare sender address to hash and to + // match against the business-senders list, and the display name to take + // initials from. Both come from the row itself, not from the load. + ThreadListModel model; + ThreadSummary summary; + summary.threadId = QStringLiteral("t1"); + summary.subject = QStringLiteral("Subject"); + summary.authors = QStringLiteral("John Doe"); + summary.firstMessageId = QStringLiteral("m1"); + summary.firstMessageSender = QStringLiteral("john@example.org"); + model.appendBatch({ summary }); + + const QModelIndex index = model.index(0, 0); + QCOMPARE(index.data(ThreadListModel::SenderAddressRole).toString(), + QStringLiteral("john@example.org")); + // The display name comes from `authors`, which is all notmuch gives. + QCOMPARE(index.data(ThreadListModel::SenderNameRole).toString(), + QStringLiteral("John Doe")); +} + void TestThreadListModel::theReplyCountExcludesTheRootMessage() { ThreadListModel model; -- cgit v1.2.3