From 99709c65f674385d6fbe9da53fe91c5f6a715880 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Sun, 9 Aug 2026 11:06:16 +0200 Subject: fix(config): report an out-of-range message_zoom The documented 0.5 to 3.0 range was already enforced, by MessageView::clampZoom(), so message_zoom = 500 rendered at 3.0 rather than unusably. What was missing is the report: the key parses, so nothing ever told the user that the value in their file is not the value on screen. Reported rather than clamped a second time. MessageView owns the bounds and does the work; a copy of the range in Config would be free to drift from the one that matters, so config.cpp reports against kMinZoom and kMaxZoom directly. This is where it differs from toolbar_icon_size, which has no widget-side enforcement to defer to. Backlog item 58, whose recorded cause was wrong on this point and has been corrected in place. --- tests/test_config.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'tests/test_config.cpp') diff --git a/tests/test_config.cpp b/tests/test_config.cpp index ec630d4..7e0d6fb 100644 --- a/tests/test_config.cpp +++ b/tests/test_config.cpp @@ -46,6 +46,7 @@ private slots: void unknownStartupQueryFallsBackAndReports(); void generalSectionKeysAreActuallyRead(); void messageZoomDefaultsAndValidates(); + void messageZoomOutOfRangeIsReported(); void completionOnFocusDefaultsToFalse(); void completionOnFocusIsActuallyRead(); void markReadDelayDefaultsToTwoSeconds(); @@ -478,6 +479,34 @@ void TestConfig::messageZoomDefaultsAndValidates() } } +void TestConfig::messageZoomOutOfRangeIsReported() +{ + // MessageView::clampZoom() already stops an out-of-range value from + // reaching the web view, so this is not about the render. It is about the + // silence: the key parses, so nothing ever told the user that the 500 they + // wrote is not what they are looking at. Not clamped here, because + // clampZoom() owns the bounds and two copies would drift. + QTemporaryDir dir; + Config config; + config.load(writeIni(dir, QStringLiteral("[general]\n" + "message_zoom=500\n"))); + QCOMPARE(config.problems().size(), 1); + QVERIFY(config.problems().first().contains(QStringLiteral("500"))); + + QTemporaryDir dir2; + Config small; + small.load(writeIni(dir2, QStringLiteral("[general]\n" + "message_zoom=0.1\n"))); + QCOMPARE(small.problems().size(), 1); + + // In range stays silent. + QTemporaryDir dir3; + Config ok; + ok.load(writeIni(dir3, QStringLiteral("[general]\n" + "message_zoom=3.0\n"))); + QVERIFY(ok.problems().isEmpty()); +} + void TestConfig::completionOnFocusDefaultsToFalse() { QTemporaryDir dir; -- cgit v1.2.3