aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-08-03 20:41:57 +0200
committerDanilo M. <danix@danix.xyz>2026-08-04 12:54:06 +0200
commitf6f11e5142911f0c4a57b08d6425d1cf99187627 (patch)
treeb5c91d17469cc6d75f67aff0e0fd99474245ab51 /tests
parentffe78f9c626ddb8d661930f911e8c1622cddfabb (diff)
downloadqtmaildir-f6f11e5142911f0c4a57b08d6425d1cf99187627.tar.gz
qtmaildir-f6f11e5142911f0c4a57b08d6425d1cf99187627.zip
feat(completion): complete nothing inside a quoted literal
subject:"foo bar has the cursor in free text, where offering keywords would be wrong.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_querycompleter.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/test_querycompleter.cpp b/tests/test_querycompleter.cpp
index 4621b19..c86edac 100644
--- a/tests/test_querycompleter.cpp
+++ b/tests/test_querycompleter.cpp
@@ -33,6 +33,8 @@ private slots:
void valueReplaceSpanExcludesThePrefix();
void prefixIsLowercased();
void emptyValueAfterColonStillCompletes();
+ void insideQuotesCompletesNothing();
+ void afterClosedQuotesCompletesAgain();
};
void TestQueryCompleter::emptyTextCompletesPrefix()
@@ -103,5 +105,21 @@ void TestQueryCompleter::emptyValueAfterColonStillCompletes()
QCOMPARE(ctx.replaceLength, 0);
}
+void TestQueryCompleter::insideQuotesCompletesNothing()
+{
+ // subject:"foo bar| is a literal, not a keyword position.
+ const QString text = QStringLiteral("subject:\"foo bar");
+ const CompletionContext ctx = completionContext(text, text.size());
+ QCOMPARE(ctx.kind, CompletionContext::None);
+}
+
+void TestQueryCompleter::afterClosedQuotesCompletesAgain()
+{
+ const QString text = QStringLiteral("subject:\"foo bar\" and ta");
+ const CompletionContext ctx = completionContext(text, text.size());
+ QCOMPARE(ctx.kind, CompletionContext::Prefix);
+ QCOMPARE(ctx.stem, QStringLiteral("ta"));
+}
+
QTEST_MAIN(TestQueryCompleter)
#include "test_querycompleter.moc"