diff options
| author | Danilo M. <danix@danix.xyz> | 2026-08-09 09:54:00 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-08-09 09:54:00 +0200 |
| commit | 955c273565521d9559e5760ca252a77c53a7aaa9 (patch) | |
| tree | 08ff85b9b46c5c823851acffa41ff11940ac6630 /tests/test_mainwindow.cpp | |
| parent | 2e66bb8b66df016164d44bf72a2d53b8c4a67dde (diff) | |
| download | qtmaildir-955c273565521d9559e5760ca252a77c53a7aaa9.tar.gz qtmaildir-955c273565521d9559e5760ca252a77c53a7aaa9.zip | |
feat(ui): make the toolbar icon size configurable
Follow-up to item 56. With the toolbar now following the desktop's
button style, an "icon only" desktop makes the icon the whole control,
and this style reports PM_ToolBarIconSize as 16px, which is a small
target for a button with no text beside it.
A [general] toolbar_icon_size key, 16 to 64, defaulting to 24 rather
than to the style's own metric. Setting it to 16 restores the theme's
value.
Clamped and reported, unlike message_zoom, which documents a 0.5 to 3.0
range in the README and enforces none of it. Both ends here break the
UI that would be used to fix them: too small is an invisible icon, too
large is a toolbar taller than the window.
The unenforced message_zoom range is recorded as item 58 rather than
fixed here, since it is a separate defect that predates this change.
Also documents in the README that saved-query button labels are the key
names from the user's own [queries] section, which is why the "Flagged"
button still read that way after the action was renamed: it is a user's
query name, not a string this code owns. The sample config now shows
`Important = tag:flagged` to teach the wording the UI uses.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Diffstat (limited to 'tests/test_mainwindow.cpp')
| -rw-r--r-- | tests/test_mainwindow.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/test_mainwindow.cpp b/tests/test_mainwindow.cpp index 4a911c9..84a3a7d 100644 --- a/tests/test_mainwindow.cpp +++ b/tests/test_mainwindow.cpp @@ -120,6 +120,7 @@ private slots: void theToolbarDoesNotOverrideTheDesktopButtonStyle(); void theImportantActionIsLabelledImportant(); void theImportantActionStillWritesTheFlaggedTag(); + void theToolbarUsesTheConfiguredIconSize(); }; void TestMainWindow::everyKnownActionIsRegistered() @@ -2513,6 +2514,34 @@ void TestMainWindow::theImportantActionStillWritesTheFlaggedTag() "written, which no other tool reading this Maildir knows"); } +void TestMainWindow::theToolbarUsesTheConfiguredIconSize() +{ + // With the toolbar following the desktop's "Icon only" style, the icons are + // the whole control, and this style reports 16px, which is a small target. + // The size is configurable with a 24px default; this proves the config + // value actually reaches the widget rather than sitting in Config unread. + QTemporaryDir dir; + QVERIFY(dir.isValid()); + const QString path = dir.filePath(QStringLiteral("qtmaildir.conf")); + QFile file(path); + QVERIFY(file.open(QIODevice::WriteOnly | QIODevice::Text)); + file.write("[general]\ntoolbar_icon_size = 40\n"); + file.close(); + + Config config; + config.load(path); + QCOMPARE(config.toolbarIconSize(), 40); + + MainWindow window(config); + auto *toolBar = window.findChild<QToolBar *>(QStringLiteral("main_toolbar")); + QVERIFY(toolBar); + + // 40 is deliberately not any of this style's own metrics (16 small, 32 + // large), so the assertion cannot pass by the widget happening to agree + // with the theme. + QCOMPARE(toolBar->iconSize(), QSize(40, 40)); +} + // Constructing a MainWindow needs a QApplication and a platform plugin. The // test has no display under ctest, so it runs offscreen unless the caller // asked for something else. |
