aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_mimeparser.cpp
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-08-14 17:14:33 +0200
committerDanilo M. <danix@danix.xyz>2026-08-14 17:14:33 +0200
commita79725e055699524ec57d09bd484f274ea4a961e (patch)
tree8ca944300b3f8e2650940154df73aa8b561bb3b8 /tests/test_mimeparser.cpp
parente876e509b0770a243725b63ea55c9ccf3e41b1bf (diff)
parentbbf3c570215688c553fd70d8f372ae215725ca02 (diff)
downloadqtmaildir-a79725e055699524ec57d09bd484f274ea4a961e.tar.gz
qtmaildir-a79725e055699524ec57d09bd484f274ea4a961e.zip
Merge: searching from the message pane (item 85)
Five surfaces in the message pane offer a search built from what they show: the header's subject and date, its sender and recipients on a single-message thread, a tag chip, a body selection, and every header per message in the details dialog. Each offers Search for this, which replaces the query, and Add to search, which narrows it. The details dialog became labelled rows along the way, which the user wanted independently of this feature. Hand tested through every surface, including the case the parenthesising exists for: adding a sender to 'tag:inbox or tag:flagged' narrows it rather than widening it.
Diffstat (limited to 'tests/test_mimeparser.cpp')
-rw-r--r--tests/test_mimeparser.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/test_mimeparser.cpp b/tests/test_mimeparser.cpp
index bac71f6..af6307e 100644
--- a/tests/test_mimeparser.cpp
+++ b/tests/test_mimeparser.cpp
@@ -47,6 +47,7 @@ private slots:
void recipientSummarySurvivesUnusableInput();
void folderNameSurvivesATimezoneComment();
void savingABatchNeverOverwrites();
+ void parsesADateWithATimezoneComment();
private:
QString fixture(const QString &name) const
@@ -485,5 +486,27 @@ void TestMimeParser::recipientSummarySurvivesUnusableInput()
recipientSummary(QStringLiteral("\"unterminated <a@example.org>"));
}
+void TestMimeParser::parsesADateWithATimezoneComment()
+{
+ // Qt::RFC2822Date rejects the WHOLE string when a trailing comment is
+ // present (verified on Qt 6.11), and "+0200 (CEST)" is both legal and
+ // common. Without the comment stripped, every such message loses its date
+ // silently: the attachment folder loses its prefix, and a date search
+ // offers nothing with no indication why.
+ const QDateTime withComment = MimeParser::parseDate(
+ QStringLiteral("Fri, 14 Aug 2026 09:30:00 +0200 (CEST)"));
+ QVERIFY(withComment.isValid());
+ QCOMPARE(withComment.date(), QDate(2026, 8, 14));
+
+ const QDateTime plain = MimeParser::parseDate(
+ QStringLiteral("Fri, 14 Aug 2026 09:30:00 +0200"));
+ QVERIFY(plain.isValid());
+ QCOMPARE(plain.date(), QDate(2026, 8, 14));
+
+ // Nothing usable is an invalid QDateTime, never a guess.
+ QVERIFY(!MimeParser::parseDate(QStringLiteral("last Tuesday")).isValid());
+ QVERIFY(!MimeParser::parseDate(QString()).isValid());
+}
+
QTEST_MAIN(TestMimeParser)
#include "test_mimeparser.moc"