Count up question bank answer timer
This commit is contained in:
@@ -21,10 +21,39 @@ func _initialize() -> void:
|
||||
_test_feedback_form_validation()
|
||||
_test_revisitable_navigation_prefers_unanswered_questions()
|
||||
_test_submit_styles_keep_stable_geometry()
|
||||
_test_core_timer_counts_up_and_remains_visible()
|
||||
await _test_player_runtime_construction()
|
||||
quit(1 if failures > 0 else 0)
|
||||
|
||||
|
||||
func _test_core_timer_counts_up_and_remains_visible() -> void:
|
||||
var player = load("res://scripts/ui/question_player.gd").new()
|
||||
var block_service = root.get_node("BlockSessionService")
|
||||
player.timer_bar = ProgressBar.new()
|
||||
player.timer_label = Label.new()
|
||||
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_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(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")
|
||||
block_service.core_question_total_elapsed_seconds = 110.0
|
||||
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")
|
||||
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")
|
||||
player.timer_bar.free()
|
||||
player.timer_label.free()
|
||||
player.timer_footer.free()
|
||||
player.free()
|
||||
|
||||
|
||||
func _test_reference_normalization() -> void:
|
||||
var service = load("res://scripts/autoload/question_bank_service.gd").new()
|
||||
var references: Array = service._normalize_references([{
|
||||
|
||||
Reference in New Issue
Block a user