Harden UI layout for font scale and long strings
- Measure and cap the HUD target chip after each font-scale change; clip HUD top labels. - Ellipsize long action-button labels so panels cannot grow past the viewport. - Add accessibility/button layout assertions and refresh the gallery captures. - Record the font/layout pass in TODO, docs, changelog and memory.
This commit is contained in:
1 parent
26e6dd6413
commit
f6aa26e6ca
20 files changed
+69
-7
No files matched your search
@@ -49,8 +49,18 @@ func test_font_scale_applies_to_core_labels() -> bool:
|
||||
hud.set_font_scale(9.0)
|
||||
var capped: int = hud.top_label.get_theme_font_size("font_size")
|
||||
var f := TestUtils.check(capped <= int(round(float(base_top) * 1.75)) + 1, "scale clamps at 1.75")
|
||||
# The target chip must widen with the scaled font instead of spilling over
|
||||
# the world; an extreme name is capped rather than pushing off-screen.
|
||||
hud.set_font_scale(1.75)
|
||||
hud.set_target_label("Intoxicated Pedestrian")
|
||||
var chip = hud.get("_target_chip")
|
||||
var chip_width: float = float(chip.offset_right) - float(chip.offset_left)
|
||||
var g := TestUtils.check(chip_width > 300.0, "target chip widens at max font scale")
|
||||
hud.set_target_label("An Extraordinarily Long Display Name For A Visitor In A Pseudo Locale")
|
||||
var long_width: float = float(chip.offset_right) - float(chip.offset_left)
|
||||
var h := TestUtils.check(long_width <= 420.5, "target chip caps an extreme name")
|
||||
hud.free()
|
||||
return a and b and c and d and e and f
|
||||
return a and b and c and d and e and f and g and h
|
||||
|
||||
func test_settings_font_scale_is_applied_after_ui_exists() -> bool:
|
||||
## The HUD is created after settings load, so the manager must re-apply.
|
||||
|
||||
Reference in new issue
Block a user