diff options
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. |
