aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_config.cpp
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-08-17 19:46:08 +0200
committerDanilo M. <danix@danix.xyz>2026-08-17 19:46:08 +0200
commitacec616bee1c7a336a9dcee8338849b970c3eab1 (patch)
treece76acee427818220c1c444d737587abc5c804d9 /tests/test_config.cpp
parent69e2173b71e94e5a89c39b20d4a5962aadb715e9 (diff)
downloadqtmaildir-acec616bee1c7a336a9dcee8338849b970c3eab1.tar.gz
qtmaildir-acec616bee1c7a336a9dcee8338849b970c3eab1.zip
feat(config): read a per-account trash folder
Diffstat (limited to 'tests/test_config.cpp')
-rw-r--r--tests/test_config.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/test_config.cpp b/tests/test_config.cpp
index 0dfda86..98743f5 100644
--- a/tests/test_config.cpp
+++ b/tests/test_config.cpp
@@ -116,6 +116,8 @@ private slots:
void draftsQuerySurvivesABracketedPath();
void allDraftsQuerySkipsAccountsWithoutTheKey();
void allDraftsQueryIsIndependentOfSent();
+ void anAccountCarriesItsTrashFolder();
+ void aBracketedTrashFolderIsQuoted();
};
static QString writeIni(const QTemporaryDir &dir, const QString &body)
@@ -953,6 +955,34 @@ void TestConfig::sentQuerySurvivesABracketedPath()
"brackets as syntax and the query will match nothing");
}
+void TestConfig::anAccountCarriesItsTrashFolder()
+{
+ QTemporaryDir dir;
+ Config config;
+ config.load(writeIni(dir, QStringLiteral(
+ "[account.work]\n"
+ "maildir=work\n"
+ "trash=Trash\n")));
+
+ const Account account = config.account(QStringLiteral("work"));
+ QCOMPARE(account.trash, QStringLiteral("Trash"));
+ // Quoted and globbed exactly as sentQuery() does it, so a folder with a
+ // space or a bracket cannot break the query.
+ QCOMPARE(account.trashQuery(), QStringLiteral("path:\"work/Trash/**\""));
+}
+
+void TestConfig::aBracketedTrashFolderIsQuoted()
+{
+ // The real setup nests a localised trash folder under a bracketed parent.
+ // The brackets are not notmuch syntax, but the quoting has to survive them.
+ Account account;
+ account.maildir = QStringLiteral("provider-a");
+ account.trash = QStringLiteral("[Provider]/Cestino");
+
+ QCOMPARE(account.trashQuery(),
+ QStringLiteral("path:\"provider-a/[Provider]/Cestino/**\""));
+}
+
void TestConfig::sentQueryComposesWithScopedQuery()
{
// A Sent view under one account must not show another account's sent mail.