From 81c0086a06d4b13478475c2fa05f040c0511bfba Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Thu, 20 Aug 2026 17:31:50 +0200 Subject: test(keys): a shortcut is a chosen subset, not a requirement, item 132 everyActionHasAShortcut() was written when the action list was short and every action plausibly deserved a chord. Item 123 adds six more, and under that rule each one consumes a key sequence whether or not anyone would ever press it. Rarely-used actions were being given chords to satisfy a test rather than because a user wanted them. everyActionIsReachableFromAMenu() is the rule that actually matters, and it already has the right shape: it is what stops an action shipping invisible, which is the defect item 103 found when `restore` was reachable by a chord and by nothing a user could see. Discoverability comes from the menu. A shortcut is an accelerator for the things done often. Nothing replaces the deleted test and nothing else needed changing: showShortcutReference() already prints `(unbound)` for an empty sequence, so the code anticipated this and only the test forbade it. Verified rather than assumed: with `tag_rules` unbound in defaultBindings(), an action that is registered, menu-reachable and carries an icon but has no chord at all, the full suite passes. Before this commit it failed. CLAUDE.md's "adding an action is FIVE places" paragraph is updated, including its count of how many are test-enforced, which drops from four to three. --- tests/CMakeLists.txt | 1 + tests/test_mainwindow.cpp | 17 ----------------- 2 files changed, 1 insertion(+), 17 deletions(-) (limited to 'tests') diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index f9bc7d1..d1d8a29 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -65,6 +65,7 @@ add_qtmaildir_test(tagdialog) add_qtmaildir_test(tagrules) add_qtmaildir_test(rulequery) add_qtmaildir_test(searchterm) +add_qtmaildir_test(busyindicator) add_qtmaildir_test(tagstrip) add_qtmaildir_test(messagedetailsdialog) add_qtmaildir_test(translations) diff --git a/tests/test_mainwindow.cpp b/tests/test_mainwindow.cpp index 0deaec3..4d70a29 100644 --- a/tests/test_mainwindow.cpp +++ b/tests/test_mainwindow.cpp @@ -178,7 +178,6 @@ private slots: void noTestCanSeeTheRealLockTable(); void everyKnownActionIsRegistered(); void everyRegisteredActionIsKnown(); - void everyActionHasAShortcut(); void configuredBindingReachesTheAction(); void cidPrefixesAreBangFree(); void cidPrefixesAreDistinctPerMessage(); @@ -489,22 +488,6 @@ void TestMainWindow::everyRegisteredActionIsKnown() } } -void TestMainWindow::everyActionHasAShortcut() -{ - // An action with no binding is unreachable from the keyboard. Every one - // of them carries a default, so an empty shortcut means the default table - // and the action list have drifted apart. - const Config config; - MainWindow window(config); - - for (const QString &name : window.registeredActionNames()) { - const QAction *action = window.findChild(name); - QVERIFY2(action, qPrintable(QStringLiteral("no QAction named '%1'").arg(name))); - QVERIFY2(!action->shortcut().isEmpty(), - qPrintable(QStringLiteral("action '%1' has no shortcut").arg(name))); - } -} - void TestMainWindow::configuredBindingReachesTheAction() { // The whole point of [keys]: a user's override must end up on the QAction, -- cgit v1.2.3