diff options
| author | Danilo M. <danix@danix.xyz> | 2026-08-29 13:05:22 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-08-29 13:05:22 +0200 |
| commit | a8e8ca13a88f99d4f6495cbb7fd28a63d93c93c8 (patch) | |
| tree | a4b3c762d72e217d19db2891a0d1413a76abb50f /tests | |
| parent | 47eea74787206efea057cbdfd12697e51ce81381 (diff) | |
| download | qtmaildir-a8e8ca13a88f99d4f6495cbb7fd28a63d93c93c8.tar.gz qtmaildir-a8e8ca13a88f99d4f6495cbb7fd28a63d93c93c8.zip | |
feat: put Star and Archive on the message bar too
Follows items 185 and 186, which established the pane's bar as where actions
on the displayed message live. Star and Archive are both selection-scoped and
fit that rule with nothing to decide; Archive leaves the main toolbar the way
Delete did, since the same icon in two places reads as two controls when the
toolbar is icon-only.
Ordered by what they do rather than by where they came from: answering the
message, then filing it, then destroying it, so the destructive button is not
between two that are not.
Mark all read deliberately stays on the main toolbar, at the user's decision.
It is the one action in this window that ignores the selection and acts on
every row in the view, so a bar whose every other entry acts on the one
displayed message is exactly where it must not be.
Item 140's toolbar test named archive as an example of a list-wide action.
That was never true of it, only untested, and this item reclassifies it: the
test now asserts archive LEFT the toolbar and keeps its guard on
mark_all_read, which is the action that genuinely is list-wide.
Closes item 189.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NY6poqw199LfFaXe5BHKNe
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_mainwindow.cpp | 47 |
1 files changed, 38 insertions, 9 deletions
diff --git a/tests/test_mainwindow.cpp b/tests/test_mainwindow.cpp index 90418e3..5817ac4 100644 --- a/tests/test_mainwindow.cpp +++ b/tests/test_mainwindow.cpp @@ -8416,8 +8416,14 @@ void TestMainWindow::theMainToolbarKeepsOnlyListWideActions() window.findChild<QToolBar *>(QStringLiteral("main_toolbar")); QVERIFY(toolBar); + // delete joined them under item 186, and archive under 189. Both act on + // the displayed message, which is the rule this test encodes; archive sat + // in the guard list below until 189 reclassified it, since "list-wide" was + // never true of it, only untested. for (const QString &name : { QStringLiteral("reply"), - QStringLiteral("forward") }) { + QStringLiteral("forward"), + QStringLiteral("delete"), + QStringLiteral("archive") }) { auto *action = window.findChild<QAction *>(name); QVERIFY2(action, qPrintable(QStringLiteral("no action %1").arg(name))); QVERIFY2(!toolBar->actions().contains(action), @@ -8426,10 +8432,12 @@ void TestMainWindow::theMainToolbarKeepsOnlyListWideActions() } // The guard: without it, a change emptying the toolbar entirely would pass - // every assertion above while deleting the feature. + // every assertion above while deleting the feature. mark_all_read is the + // one item 189 deliberately kept, being the only action here that ignores + // the selection outright. for (const QString &name : { QStringLiteral("compose"), QStringLiteral("sync"), - QStringLiteral("archive"), + QStringLiteral("mark_all_read"), QStringLiteral("undo") }) { auto *action = window.findChild<QAction *>(name); QVERIFY2(action && toolBar->actions().contains(action), @@ -13892,6 +13900,18 @@ void TestMainWindow::theMessageBarSwapsToTheTrashActionsOnTrashedMail() "the message bar lost Forward on ordinary mail"); QVERIFY2(barHolds(QStringLiteral("delete")), "Delete did not arrive on the message bar (item 186)"); + // Item 189, the same move for the two that followed it. + QVERIFY2(barHolds(QStringLiteral("flag")), + "Star did not arrive on the message bar (item 189)"); + QVERIFY2(barHolds(QStringLiteral("archive")), + "Archive did not arrive on the message bar (item 189)"); + // And the one that deliberately did NOT move. mark_all_read ignores the + // selection and acts on every row in the view, so a bar whose every other + // entry acts on one message is where it must not be. The user's call, and + // asserted so it cannot drift in later. + QVERIFY2(!barHolds(QStringLiteral("mark_all_read")), + "Mark all read is on the message bar, where a view-wide action " + "sits among per-message ones (item 189)"); QVERIFY2(!barHolds(QStringLiteral("restore")), "Restore is offered on mail that was never deleted"); QVERIFY2(!barHolds(QStringLiteral("purge")), @@ -13902,13 +13922,22 @@ void TestMainWindow::theMessageBarSwapsToTheTrashActionsOnTrashedMail() auto *mainBar = window.findChild<QToolBar *>(QStringLiteral("main_toolbar")); QVERIFY(mainBar); const auto mainActions = mainBar->actions(); - QVERIFY2(std::none_of(mainActions.cbegin(), mainActions.cend(), - [](const QAction *action) { - return action - && action->objectName() - == QStringLiteral("delete"); - }), + const auto mainBarHolds = [&](const QString &name) { + return std::any_of(mainActions.cbegin(), mainActions.cend(), + [&](const QAction *action) { + return action && action->objectName() == name; + }); + }; + QVERIFY2(!mainBarHolds(QStringLiteral("delete")), "Delete is still on the main toolbar as well as the message bar"); + QVERIFY2(!mainBarHolds(QStringLiteral("archive")), + "Archive is still on the main toolbar as well as the message bar"); + + // The guard, and the half that matters: with no positive assertion here a + // main toolbar that had lost EVERYTHING would pass the three checks + // above. mark_all_read is the action item 189 decided must stay. + QVERIFY2(mainBarHolds(QStringLiteral("mark_all_read")), + "Mark all read left the main toolbar, where item 189 kept it"); // And the trash, which is the whole point. QVERIFY2(selectById(QStringLiteral("trashed1@example.org")), |
