Correct question toolbar controls

This commit is contained in:
hz
2026-07-18 15:29:21 -05:00
parent ea36692c40
commit eb8747d48e
8 changed files with 125 additions and 75 deletions
-2
View File
@@ -29,11 +29,9 @@ func _initialize() -> void:
service.seconds_remaining = 450.0
_assert(is_equal_approx(service.get_session_timer_ratio(), 0.5), "timed block progress should use the full session duration")
service.session_kind = "core"
service.core_question_display_target_seconds = 100.0
service.core_question_total_elapsed_seconds = 25.0
service.core_question_total_active_since = 0.0
_assert(is_equal_approx(service.get_core_question_total_elapsed_seconds(), 25.0), "core question timer should expose cumulative elapsed time")
_assert(is_equal_approx(service.get_core_question_elapsed_ratio(), 0.25), "core question progress should fill toward its original target")
service._start_core_retry_window()
_assert(is_equal_approx(service.get_core_question_total_elapsed_seconds(), 25.0), "wrong-answer retry windows should not reset cumulative question time")
service.core_question_total_active_since = 100.0
+17 -8
View File
@@ -36,17 +36,20 @@ func _test_core_timer_counts_up_and_remains_visible() -> void:
player.timer_footer = HBoxContainer.new()
player.timer_color_state = ""
block_service.session_kind = "core"
block_service.core_question_display_target_seconds = 100.0
block_service.core_current_target_seconds = 100.0
block_service.current_question_started_at = 0.001
block_service.current_question_pause_started_at = 25.001
block_service.core_question_total_elapsed_seconds = 75.0
block_service.core_question_total_active_since = 0.0
player._set_answer_review_timer_visibility()
_assert(player.timer_footer.visible and player.timer_bar.visible and player.timer_label.visible, "core timer should remain visible during correct-answer review")
_assert(is_equal_approx(player.timer_bar.value, 75.0), "core timer bar should fill with elapsed progress")
_assert(is_equal_approx(player.timer_bar.value, 75.0), "core timer bar should retain its original remaining-time progress")
_assert(player.timer_label.text == "01:15", "core timer should display cumulative elapsed time")
_assert(player.timer_color_state == "amber", "core timer should warn when approaching its target")
_assert(player.timer_color_state == "blue", "core timer should retain its original remaining-time warning behavior")
block_service.core_question_total_elapsed_seconds = 110.0
block_service.current_question_pause_started_at = 110.001
player._update_timer_bar()
_assert(is_equal_approx(player.timer_bar.value, 100.0) and player.timer_color_state == "red", "core timer should remain full and red after exceeding its target")
_assert(is_equal_approx(player.timer_bar.value, 0.0) and player.timer_color_state == "red", "core timer bar should empty and turn red after exceeding its target")
block_service.session_kind = "block"
player._set_answer_review_timer_visibility()
_assert(not player.timer_footer.visible, "non-core answer review should retain its existing hidden timer")
@@ -342,12 +345,18 @@ func _test_player_runtime_construction() -> void:
_assert(player.navigator_popup != null, "question player should construct its popup navigator")
_assert(player.header_row.get_node_or_null("StepBadge") == null, "question player should not display a redundant STEP 3 badge")
_assert(player.header_row.get_child(0) == player.progress_button, "question progress should be the first header item")
_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")
var clear_box := player.clear_highlight_button.get_theme_stylebox("normal") as StyleBoxTexture
var report_box := player.report_button.get_theme_stylebox("normal") as StyleBoxTexture
var labs_box := player.labs_button.get_theme_stylebox("normal") as StyleBoxTexture
_assert(clear_box != null and clear_box.texture != null, "clear highlights should use the supplied toolbar artwork")
_assert(report_box != null and report_box.texture != null, "report question should use the supplied toolbar artwork")
_assert(labs_box != null and labs_box.texture != null, "lab results should use the supplied toolbar artwork")
player._style_asset_toolbar_button(player.clear_highlight_button, player.CLEAR_HIGHLIGHT_LIGHT_ICON)
_assert(player.clear_highlight_button.icon == player.CLEAR_HIGHLIGHT_LIGHT_ICON, "clear highlights should support its light-mode artwork")
clear_box = player.clear_highlight_button.get_theme_stylebox("normal") as StyleBoxTexture
_assert(clear_box.texture == player.CLEAR_HIGHLIGHT_LIGHT_ICON, "clear highlights should support its light-mode artwork")
player._style_asset_toolbar_button(player.report_button, player.REPORT_QUESTION_LIGHT_ICON)
_assert(player.report_button.icon == player.REPORT_QUESTION_LIGHT_ICON, "report question should support its light-mode artwork")
report_box = player.report_button.get_theme_stylebox("normal") as StyleBoxTexture
_assert(report_box.texture == player.REPORT_QUESTION_LIGHT_ICON, "report question should support its light-mode artwork")
var toggle_box := player.theme_button.get_theme_stylebox("normal") as StyleBoxFlat
_assert(player.theme_button.custom_minimum_size == Vector2(44, 44), "question theme toggle should retain the shared square footprint")
_assert(toggle_box != null and toggle_box.corner_radius_top_left == 22, "question theme toggle should use the shared circular treatment")