From 2d5a2490394699d8cc23c2564222e5087cdafc06 Mon Sep 17 00:00:00 2001 From: ispyisail Date: Sat, 10 Oct 2026 07:28:03 +1300 Subject: [PATCH] Fix tst_genericdevice failing on machines without Liberation Sans edgeCases() expected an empty device to be exactly MinHeight (30) tall. The sizing rule is max(MinHeight, 2 x label height) rounded up to the grid, so with a taller fallback font the body is 40 and the test fails. The Linux CI image has no Liberation Sans; fontconfig substitutes Nimbus Sans (fonts-urw-base35), whose line height gives 40. Compute the expected height from the label font's metrics, as the layout does. Reproduced locally with a fontconfig file listing only the urw-base35 fonts: the old test fails with the CI's exact message (40 vs 30), the new one passes. Doubling the label factor to 3 in genericdevice.cpp still makes the new check fail, with Liberation and with Nimbus. Reported by bhangart on #1418. Co-Authored-By: Claude Opus 5.5 --- tests/qttest/tst_genericdevice.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/qttest/tst_genericdevice.cpp b/tests/qttest/tst_genericdevice.cpp index d4637799b..8f81d0b6b 100644 --- a/tests/qttest/tst_genericdevice.cpp +++ b/tests/qttest/tst_genericdevice.cpp @@ -1,4 +1,5 @@ // SPDX-License-Identifier: GPL-2.0-or-later +#include #include #include "genericdevice/genericdevice.h" @@ -353,7 +354,11 @@ private slots: //No terminals: the minimum, or as wide as the label needs QVERIFY(l.body_width >= MinWidth); QCOMPARE(l.body_width % Grid, 0); - QCOMPARE(l.body_height, MinHeight); + //The label sets the floor when its font is taller than + //MinHeight allows, which depends on the fonts installed + const int label_h = int(qCeil(QFontMetricsF(fonts().label).height())); + const int floor_h = std::max(MinHeight, 2 * label_h); + QCOMPARE(l.body_height, (floor_h + Grid - 1) / Grid * Grid); QVERIFY(l.terminals.isEmpty()); Spec one;