Fix eliminated-choice strikethrough disappearing on wrong/correct reveal
A choice that was crossed out (right-click) and also happened to be locked as the submitted-wrong choice, or revealed as the correct answer, silently lost its strikethrough because the percentage-badge branches took precedence over the elimination check in the same if/elif chain. Decoupled the two so a choice can show both the strikethrough and its reveal percentage at once.
This commit is contained in:
@@ -11,6 +11,7 @@ func _initialize() -> void:
|
||||
_test_correct_feedback_does_not_auto_advance()
|
||||
_test_correct_review_locks_answer_interactions()
|
||||
_test_eliminated_choice_uses_rich_text_strikeout()
|
||||
_test_eliminated_choice_that_is_also_locked_wrong_still_strikes_through()
|
||||
_test_explanation_highlighting_has_no_status_heading()
|
||||
_test_collapsed_followup_review_expands()
|
||||
_test_review_content_normalization()
|
||||
@@ -143,6 +144,27 @@ func _test_eliminated_choice_uses_rich_text_strikeout() -> void:
|
||||
player.free()
|
||||
|
||||
|
||||
func _test_eliminated_choice_that_is_also_locked_wrong_still_strikes_through() -> void:
|
||||
var player = load("res://scripts/ui/question_player.gd").new()
|
||||
player.choice_buttons.append(Button.new())
|
||||
player.choice_percent_labels.append(Label.new())
|
||||
var strike_label := RichTextLabel.new()
|
||||
strike_label.bbcode_enabled = true
|
||||
player.choice_top_labels.append(strike_label)
|
||||
player.choice_followup_panels.append(PanelContainer.new())
|
||||
player.eliminated = ["A"]
|
||||
player.locked_wrong_choice_ids = ["A"]
|
||||
player.presented_choices = [{"id": "A", "text": "Observation only"}]
|
||||
player._set_choice_button_text(0, player.presented_choices[0])
|
||||
_assert(strike_label.text == "[s]Observation only[/s]", "a choice that's both eliminated and locked-wrong should still strike through")
|
||||
_assert(player.choice_buttons[0].text == "", "the struck-through choice's button text should stay cleared")
|
||||
player.choice_buttons[0].free()
|
||||
player.choice_percent_labels[0].free()
|
||||
strike_label.free()
|
||||
player.choice_followup_panels[0].free()
|
||||
player.free()
|
||||
|
||||
|
||||
func _test_explanation_highlighting_has_no_status_heading() -> void:
|
||||
var player = load("res://scripts/ui/question_player.gd").new()
|
||||
player.explanation_label = RichTextLabel.new()
|
||||
|
||||
Reference in New Issue
Block a user