You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#927 fixed button labels being clipped in several dialogs, caused by
hardcoded setMaximumWidth() / setFixedWidth() on text buttons. The
problem only showed up in some languages (de, de_CH, pl, cs, es, fr, pt, nl),
so it went unnoticed until a user reported it. Nothing in CI would catch it if
it came back through a new dialog, a new language, or a longer translation.
Proposal
Add a test that, for every language in AVAILABLE_LANGUAGES, builds the
relevant dialogs and asserts that every QPushButton with a text label is at
least as wide as its sizeHint():
The test should compare each button against its own sizeHint() rather than
against absolute pixel values. That way it stays valid regardless of platform,
font and display scaling.
A generic approach that walks all dialogs and collects every QPushButton
via findChildren() would be better, if it's practical to instantiate them in
a test.
Notes
Use the existing pytest-qt setup and the gui marker (see tests/unit-tests/test_dialog_widgets.py for an existing pattern).
Skip icon-only buttons (🗑, ▲/▼, ✕ etc.). They are intentionally narrow and
have no translated text.
The dialogs must be shown or have their layout activated before measuring,
otherwise width() doesn't reflect the actual layout.
Follow-up to #927 (Part 2).
Background
#927 fixed button labels being clipped in several dialogs, caused by
hardcoded
setMaximumWidth()/setFixedWidth()on text buttons. Theproblem only showed up in some languages (de, de_CH, pl, cs, es, fr, pt, nl),
so it went unnoticed until a user reported it. Nothing in CI would catch it if
it came back through a new dialog, a new language, or a longer translation.
Proposal
Add a test that, for every language in
AVAILABLE_LANGUAGES, builds therelevant dialogs and asserts that every
QPushButtonwith a text label is atleast as wide as its
sizeHint():The test should compare each button against its own
sizeHint()rather thanagainst absolute pixel values. That way it stays valid regardless of platform,
font and display scaling.
Scope
At minimum, the dialogs touched by #927:
dialogs/database_dialog.py(New Database)dialogs/gps_dialog.pydialogs/widgets.py(path row with Browse button, used by the Welcome Wizard)cache_detail.py(decode hint button)dialogs/filter_dialog.pyanddialogs/column_dialog.py(Save button)dialogs/coord_converter_dialog.py,projection_dialog.py,midpoint_dialog.py,corrected_coords_dialog.py(Copy buttons)A generic approach that walks all dialogs and collects every
QPushButtonvia
findChildren()would be better, if it's practical to instantiate them ina test.
Notes
pytest-qtsetup and theguimarker (seetests/unit-tests/test_dialog_widgets.pyfor an existing pattern).have no translated text.
otherwise
width()doesn't reflect the actual layout.isolation in
tests/conftest.py(Test suite can leak into the real user profile if a test lacks its own install_dir/logging isolation #829) should keep this away from real userdata.
button, e.g.
test_buttons_not_clipped[de-database_dialog].Acceptance criteria
dein the New Databasedialog (i.e. it would have caught the original report)
betafor all languages