summaryrefslogtreecommitdiffstats
path: root/tests/test_config.cpp
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-08-15 11:24:07 +0200
committerDanilo M. <danix@danix.xyz>2026-08-15 11:24:07 +0200
commita15505d408895d53f2fb4321836931a1b0742b7d (patch)
tree169e926120b245d162b7c444f2343883c4291181 /tests/test_config.cpp
parent6bdf5039fa5232206f4f55db6e269038ca83358a (diff)
downloadqtmaildir-a15505d408895d53f2fb4321836931a1b0742b7d.tar.gz
qtmaildir-a15505d408895d53f2fb4321836931a1b0742b7d.zip
fix(filters): label the flagged filter Important, and give the four icons
Item 57 renamed the `flag` action to "Important" in 0.14.0, chosen over "Starred" partly because &I was free where &S collided with Mark spam. Item 93 then shipped the filter for the same tag as "Flagged", so one window offered both names for one thing. The generator keeps its own name, `flagged`: that string is stored in queries.json and matched against a closed set, so it is wire format rather than a label. The filters are QToolButtons now, like the Save button at the other end of the row, carrying a themed icon with the text beside it. Icon AND text for the reason the Save button already records: this row is a row of text buttons, so an icon alone reads as a different kind of control than it is. Theme icons rather than the shipped SVGs in Marks, because item 70's split is that the panes are ours and the chrome is the system's, and the query row is chrome. mail-mark-important matches the `flag` action's own icon, since the filter finds what the action marks. The icon test asserts a NAME was requested rather than that the icon resolved: QIcon::fromTheme returns null where no icon theme is installed, so isNull() would fail for a reason unrelated to this code. Dropping the setIcon call fails it. Widening the buttons to QToolButton broke eleven tests that reached them through findChild<QPushButton *>, which does not match a sibling type. The helpers and the filter lookups take QAbstractButton; savedQueryButton() stays on QPushButton, since the user's own queries really are those.
Diffstat (limited to 'tests/test_config.cpp')
-rw-r--r--tests/test_config.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/tests/test_config.cpp b/tests/test_config.cpp
index 6c1815c..e5487b8 100644
--- a/tests/test_config.cpp
+++ b/tests/test_config.cpp
@@ -96,6 +96,7 @@ private slots:
void allSentQuerySkipsAccountsWithoutTheKey();
void allSentQueryJoinsEveryConfiguredAccount();
void aStoredGeneratedQueryIsUnpinnedNotDropped();
+ void theFlaggedFilterIsCalledImportant();
void everyBuiltinFilterIsAKnownGenerator();
void aFilterAcrossAllAccountsIsTheUnscopedQuery();
void aTagFilterScopedToAnAccountCarriesThatAccountsPath();
@@ -1042,6 +1043,23 @@ static QString writeTwoAccounts(const QTemporaryDir &dir)
"maildir=personal\n"));
}
+void TestConfig::theFlaggedFilterIsCalledImportant()
+{
+ // Item 57 decided this and item 93 contradicted it. The `flag` ACTION has
+ // read "&Important" since 0.14.0, chosen over "Starred" partly because &I
+ // was free where &S collided with Mark spam, and the filter shipped as
+ // "Flagged" beside it: the same tag under two names in one window.
+ //
+ // The generator keeps its own name, `flagged`. That string is stored in
+ // queries.json and matched against a closed set, so it is wire format and
+ // must not follow the label.
+ const SavedQuery filter =
+ Config::builtinFilter(QStringLiteral("flagged"));
+
+ QCOMPARE(filter.name, QStringLiteral("Important"));
+ QCOMPARE(filter.generated, QStringLiteral("flagged"));
+}
+
void TestConfig::everyBuiltinFilterIsAKnownGenerator()
{
// The guard for every case below. A filter whose generator is not in the
@@ -1071,7 +1089,7 @@ void TestConfig::everyBuiltinFilterIsAKnownGenerator()
// surface for this would be built and deleted inside two items.
QCOMPARE(names, (QStringList{ QStringLiteral("Unread"),
QStringLiteral("Inbox"),
- QStringLiteral("Flagged"),
+ QStringLiteral("Important"),
QStringLiteral("Sent") }));
}