Fix long answer choice layout
This commit is contained in:
@@ -562,7 +562,10 @@ func _ready() -> void:
|
||||
|
||||
var button := Button.new()
|
||||
button.custom_minimum_size = Vector2(0, 68)
|
||||
button.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||
button.alignment = HORIZONTAL_ALIGNMENT_LEFT
|
||||
button.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
||||
button.text_overrun_behavior = TextServer.OVERRUN_NO_TRIMMING
|
||||
Style.style_answer_button(button)
|
||||
UISoundService.set_button_sound(button, "select")
|
||||
_set_scaled_button_font(button, 17)
|
||||
@@ -672,6 +675,7 @@ func _ready() -> void:
|
||||
|
||||
actions = HBoxContainer.new()
|
||||
actions.add_theme_constant_override("separation", 16)
|
||||
actions.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||
card_content.add_child(actions)
|
||||
|
||||
skip_button = Button.new()
|
||||
@@ -709,6 +713,7 @@ func _ready() -> void:
|
||||
next_button.text = "Submit Block" if BlockSessionService.session_kind == "simulation" and BlockSessionService.current_index + 1 == BlockSessionService.active_questions.size() else "Next" if BlockSessionService.session_kind == "simulation" else "Submit"
|
||||
next_button.tooltip_text = ""
|
||||
next_button.custom_minimum_size = Vector2(140, 48)
|
||||
next_button.size_flags_horizontal = Control.SIZE_SHRINK_END
|
||||
Style.style_primary_button(next_button)
|
||||
next_button.pressed.connect(_submit_or_next)
|
||||
actions.add_child(next_button)
|
||||
|
||||
@@ -385,6 +385,7 @@ func _test_timer_text_avoids_redundant_frame_updates() -> void:
|
||||
|
||||
func _test_player_runtime_construction() -> void:
|
||||
var host := Control.new()
|
||||
host.size = Vector2(1280, 720)
|
||||
root.add_child(host)
|
||||
var player = load("res://scripts/ui/question_player.gd").new()
|
||||
player.main = host
|
||||
@@ -416,6 +417,14 @@ func _test_player_runtime_construction() -> void:
|
||||
_assert(player.theme_button.icon in [Brand.SUN_ICON, Brand.MOON_ICON], "question theme toggle should use the shared sun or moon icon")
|
||||
_assert(player.choice_badges.size() == 5, "question player should construct an answer badge for every visible choice slot")
|
||||
_assert(player.choice_followup_panels[2].get_parent() == player.choice_rows[2], "distractor remediation should remain nested inside its answer choice")
|
||||
var long_choice := "Transfer to a neurocritical-care center, use a titratable agent to avoid severe hypertension and blood-pressure variability without causing hypotension, start enteral nimodipine, and secure the aneurysm as early as feasible."
|
||||
player.choice_buttons[0].text = long_choice
|
||||
await process_frame
|
||||
await process_frame
|
||||
_assert(player.choice_buttons[0].autowrap_mode == TextServer.AUTOWRAP_WORD_SMART, "long answer choices should use word-smart wrapping")
|
||||
_assert(player.choice_buttons[0].size.y > 68.0, "a wrapped answer choice should grow taller than the standard answer row")
|
||||
_assert(player.choice_buttons[0].size.x <= player.question_panel.size.x, "long answer choices should not widen the question player")
|
||||
_assert(player.next_button.get_global_rect().end.x <= player.get_global_rect().end.x + 0.5, "long answer choices should never push Submit beyond the viewport")
|
||||
var prior_session_kind: String = root.get_node("BlockSessionService").session_kind
|
||||
for session_kind in ["block", "core", "bookmark", "review", "simulation"]:
|
||||
root.get_node("BlockSessionService").session_kind = session_kind
|
||||
|
||||
Reference in New Issue
Block a user