fix: prove title timing and compact journal readability
This commit is contained in:
@@ -50,9 +50,8 @@ func test_real_hit_unlocks_reward_toast_journal_claim_and_title_refresh() -> voi
|
||||
assert_eq(notification.text, "Frappeur")
|
||||
assert_true(notification_timer.one_shot)
|
||||
assert_eq(notification_timer.wait_time, 5.0)
|
||||
notification_timer.timeout.emit()
|
||||
await get_tree().process_frame
|
||||
assert_false(notification.visible, "The title notification disappears at timeout")
|
||||
# The real five-second expiry is intentionally verified by the dedicated
|
||||
# transition test below, rather than manually emitting this timer's signal.
|
||||
if permanent_title != null:
|
||||
assert_eq(permanent_title.text, "Étage 0")
|
||||
|
||||
@@ -63,6 +62,56 @@ func test_real_hit_unlocks_reward_toast_journal_claim_and_title_refresh() -> voi
|
||||
assert_true(game.get_run_state().recent_events(3).any(func(event: GameEvent) -> bool: return event.kind == &"achievement_reward_claimed"))
|
||||
assert_string_contains((panel.get_node("Body") as RichTextLabel).get_parsed_text(), "Récompense reçue")
|
||||
|
||||
func test_title_notification_only_announces_real_transitions_and_expires_after_its_timer() -> void:
|
||||
var permanent_title := game.get_node_or_null("HUD/TitleLabel") as Label
|
||||
var notification := game.get_node_or_null("HUD/TitleNotificationLabel") as Label
|
||||
var notification_timer := game.get_node_or_null("HUD/TitleNotificationTimer") as Timer
|
||||
assert_not_null(permanent_title)
|
||||
assert_not_null(notification)
|
||||
assert_not_null(notification_timer)
|
||||
if permanent_title == null or notification == null or notification_timer == null:
|
||||
return
|
||||
|
||||
assert_false(notification.visible, "Initialization must not announce the established title")
|
||||
assert_eq(notification.text, "")
|
||||
assert_eq(permanent_title.text, "Étage 0")
|
||||
|
||||
game._refresh_title()
|
||||
assert_false(notification.visible, "Refreshing the same current title stays silent")
|
||||
assert_eq(permanent_title.text, "Étage 0")
|
||||
|
||||
game.title_engine = TitleEngineType.new([])
|
||||
game._refresh_title()
|
||||
assert_false(notification.visible, "Losing a title or receiving no title stays silent")
|
||||
assert_eq(notification.text, "")
|
||||
assert_eq(permanent_title.text, "Étage 0")
|
||||
|
||||
game.title_engine = TitleEngineType.new([
|
||||
{"id": "renewed", "name": "Renouveau", "rank": 1, "conditions": []},
|
||||
])
|
||||
game._refresh_title()
|
||||
assert_true(notification.visible, "A real title transition needs a temporary notification")
|
||||
assert_eq(notification.text, "Renouveau")
|
||||
assert_true(notification_timer.time_left > 0.0)
|
||||
assert_eq(permanent_title.text, "Étage 0")
|
||||
|
||||
game.title_engine = TitleEngineType.new([])
|
||||
game._refresh_title()
|
||||
assert_false(notification.visible, "A title loss clears an in-flight notification")
|
||||
assert_eq(notification.text, "")
|
||||
assert_eq(permanent_title.text, "Étage 0")
|
||||
|
||||
game.title_engine = TitleEngineType.new([
|
||||
{"id": "renewed", "name": "Renouveau", "rank": 1, "conditions": []},
|
||||
])
|
||||
game._refresh_title()
|
||||
assert_true(notification.visible, "Regaining a title is a real transition")
|
||||
await notification_timer.timeout
|
||||
await get_tree().process_frame
|
||||
assert_false(notification.visible, "The actual five-second timer hides the notification")
|
||||
assert_eq(notification.text, "")
|
||||
assert_eq(permanent_title.text, "Étage 0")
|
||||
|
||||
func _dispatch_key(keycode: Key) -> void:
|
||||
Input.parse_input_event(_key_event(keycode, true))
|
||||
await get_tree().process_frame
|
||||
|
||||
Reference in New Issue
Block a user