Add exam-style question calculator

This commit is contained in:
hz
2026-07-23 05:19:12 -05:00
parent ba155fd38a
commit 50f07a77a5
8 changed files with 673 additions and 4 deletions
+9 -3
View File
@@ -361,6 +361,8 @@ func _test_player_runtime_construction() -> void:
_assert(player.clear_highlight_button.icon != null, "clear highlights should use the supplied toolbar artwork")
_assert(player.report_button.icon != null, "report question should use the supplied toolbar artwork")
_assert(player.labs_button.icon != null, "lab results should use the supplied toolbar artwork")
_assert(player.calculator_button != null and player.calculator_button.icon != null, "every question mode should expose the calculator tool")
_assert(player.calculator_panel != null, "question player should construct the floating calculator once")
_assert(player.notes_button != null and player.notes_button.icon != null, "practice questions should expose the notes tool")
for icon_button in [player.clear_highlight_button, player.report_button, player.labs_button]:
_assert(icon_button.alignment == HORIZONTAL_ALIGNMENT_CENTER and icon_button.icon_alignment == HORIZONTAL_ALIGNMENT_CENTER, "question toolbar artwork should be horizontally centered")
@@ -377,12 +379,16 @@ func _test_player_runtime_construction() -> void:
_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 prior_session_kind: String = root.get_node("BlockSessionService").session_kind
root.get_node("BlockSessionService").session_kind = "simulation"
player._refresh_toolbar_state()
_assert(not player.notes_button.visible, "timed simulations should hide the notes tool")
for session_kind in ["block", "core", "bookmark", "review", "simulation"]:
root.get_node("BlockSessionService").session_kind = session_kind
player._refresh_toolbar_state()
_assert(player.calculator_button.visible, "%s question sessions should expose the calculator tool" % session_kind)
root.get_node("BlockSessionService").session_kind = "core"
player._refresh_toolbar_state()
_assert(player.notes_button.visible, "practice question runs should show the notes tool")
root.get_node("BlockSessionService").session_kind = "simulation"
player._refresh_toolbar_state()
_assert(not player.notes_button.visible, "timed simulations should hide the notes tool")
root.get_node("BlockSessionService").session_kind = prior_session_kind
player.choice_followup_panels[2].visible = true
player.locked_wrong_choice_ids = ["C"]