aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-08-26 15:55:13 +0200
committerDanilo M. <danix@danix.xyz>2026-08-26 15:55:13 +0200
commitca5b6ca711e73bc22fdf108e06d82241e059c6ee (patch)
tree26fc84fb4f5de11fbf71179fe2f3dc7eb9c01f2e /tests
parent5e769b073062a8913d2c4250d079aeb2d7d7b0e8 (diff)
downloadqtmaildir-ca5b6ca711e73bc22fdf108e06d82241e059c6ee.tar.gz
qtmaildir-ca5b6ca711e73bc22fdf108e06d82241e059c6ee.zip
feat: expose a row's sender to the delegate
Diffstat (limited to 'tests')
-rw-r--r--tests/test_threadlistmodel.cpp23
1 files changed, 23 insertions, 0 deletions
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;