From 63b9d3c557b191269914bbb379c78e312cbf5cf1 Mon Sep 17 00:00:00 2001 From: hz Date: Sun, 9 Aug 2026 21:35:41 -0500 Subject: [PATCH] Fix CCS vitals layout --- scripts/ui/ccs_cases_2/doctor_office.gd | 7 ++++++- tests/ccs_cases_2_ui_test.gd | 9 +++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/scripts/ui/ccs_cases_2/doctor_office.gd b/scripts/ui/ccs_cases_2/doctor_office.gd index 327f5c6..7e08ae2 100644 --- a/scripts/ui/ccs_cases_2/doctor_office.gd +++ b/scripts/ui/ccs_cases_2/doctor_office.gd @@ -324,15 +324,20 @@ func _render_vitals(vitals: Dictionary) -> void: var rows := _build_vital_rows(vitals) for row in rows: var name_label := Label.new() + name_label.custom_minimum_size.x = 230.0 + name_label.size_flags_horizontal = Control.SIZE_EXPAND_FILL name_label.add_theme_font_size_override("font_size", 19) name_label.add_theme_color_override("font_color", Color(0.18, 0.25, 0.31)) name_label.text = "%s:" % str(row.get("label", "Vital sign")) vitals_rows.add_child(name_label) var value_label := Label.new() + value_label.custom_minimum_size.x = 230.0 + value_label.size_flags_horizontal = Control.SIZE_EXPAND_FILL value_label.add_theme_font_size_override("font_size", 19) value_label.add_theme_color_override("font_color", Color(0.04, 0.09, 0.13)) value_label.text = str(row.get("value", "")) - value_label.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART + value_label.autowrap_mode = TextServer.AUTOWRAP_OFF + value_label.clip_text = true vitals_rows.add_child(value_label) vitals_rows.visible = not rows.is_empty() vitals_empty.visible = rows.is_empty() diff --git a/tests/ccs_cases_2_ui_test.gd b/tests/ccs_cases_2_ui_test.gd index 701de5f..8177d2d 100644 --- a/tests/ccs_cases_2_ui_test.gd +++ b/tests/ccs_cases_2_ui_test.gd @@ -96,6 +96,7 @@ func _run() -> void: screen.active_scene.vitals_launcher.pressed.emit() _assert(screen.active_scene.is_vitals_open(), "the Vitals app should open a nurse vital-sign window") _assert(_vital_values(screen.active_scene) == ["36.8 C (98.2 F)", "76/min", "14/min", "122 mm Hg", "76 mm Hg", "99% on room air"], "the Vitals app should render the active attempt data in clinical order") + _assert(_vital_values_fit(screen.active_scene), "vital values should retain a readable column without character-by-character wrapping") _assert(screen.close_transient_overlay(), "the first Escape should close the Vitals app") _assert(not screen.active_scene.is_vitals_open() and screen.active_scene.is_computer_open(), "closing Vitals should return to the computer desktop") _assert(screen.close_transient_overlay(), "the second Escape should close the computer") @@ -307,6 +308,14 @@ func _vital_values(scene: Control) -> Array: return values +func _vital_values_fit(scene: Control) -> bool: + for index in range(1, scene.vitals_rows.get_child_count(), 2): + var label := scene.vitals_rows.get_child(index) as Label + if label == null or label.size.x < 220.0 or label.get_line_count() != 1: + return false + return true + + func _choice_labels_fit(scene: Control) -> bool: for button in scene.choice_container.get_children(): var label := button.get_child(0) as Label