NEO-122: Repaint quest HUD when definitions load.
Definitions ready now re-renders progress rows when a snapshot exists even after a progress sync error, so display names replace raw ids.pull/161/head
parent
c663721d34
commit
bada3024c2
|
|
@ -117,7 +117,7 @@ func _on_accept_failed(_quest_id: String, reason: String) -> void:
|
|||
|
||||
func _on_definitions_ready(_quests: Array) -> void:
|
||||
_defs_error = ""
|
||||
if _progress_error.is_empty() and not _last_snapshot.is_empty():
|
||||
if not _last_snapshot.is_empty():
|
||||
_render_progress_label()
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -381,3 +381,36 @@ func test_shift_q_shows_definitions_error_when_defs_failed() -> void:
|
|||
controller.call("_request_eligible_accept")
|
||||
# Assert
|
||||
assert_str(accept_label.text).contains("definitions error")
|
||||
|
||||
|
||||
func _gather_defs_json() -> String:
|
||||
return (
|
||||
'{"schemaVersion":1,"quests":['
|
||||
+ '{"id":"prototype_quest_gather_intro","displayName":"Intro: Salvage Run",'
|
||||
+ '"prerequisiteQuestIds":[],"steps":[]}]}'
|
||||
)
|
||||
|
||||
|
||||
func test_definitions_ready_repaints_with_display_names_when_progress_error() -> void:
|
||||
# Arrange
|
||||
var defs_transport := MockHttpTransport.new()
|
||||
defs_transport.body_json = _gather_defs_json()
|
||||
var defs_client: Node = _make_defs_client(defs_transport)
|
||||
var progress_client: Node = _make_progress_client(NoopHttpTransport.new())
|
||||
var controller: Node = QuestHudController.new()
|
||||
var progress_label := Label.new()
|
||||
auto_free(controller)
|
||||
auto_free(progress_label)
|
||||
add_child(controller)
|
||||
await get_tree().process_frame
|
||||
defs_client.call("request_sync_from_server")
|
||||
controller.set("_progress_client", progress_client)
|
||||
controller.set("_defs_client", defs_client)
|
||||
controller.set("_progress_label", progress_label)
|
||||
controller.set("_last_snapshot", _not_started_snapshot())
|
||||
controller.set("_progress_error", "HTTP 503")
|
||||
# Act
|
||||
controller.call("_on_definitions_ready", [])
|
||||
# Assert
|
||||
assert_str(progress_label.text).contains("Intro: Salvage Run")
|
||||
assert_str(progress_label.text).not_contains("prototype_quest_gather_intro")
|
||||
|
|
|
|||
|
|
@ -61,6 +61,8 @@ Seven commits landed after the first review: code-review follow-up (quest-defini
|
|||
|
||||
7. ~~**Shift+Q hides definitions failure** — Block eligible accept when `_defs_error` is set and catalog is empty. **Done.**
|
||||
|
||||
8. ~~**Definitions ready skips HUD repaint** — `_on_definitions_ready` repaints when snapshot exists even if `_progress_error` is set so display names replace raw ids. **Done.**
|
||||
|
||||
## Verification
|
||||
|
||||
```bash
|
||||
|
|
@ -70,7 +72,7 @@ godot --headless --path . -s addons/gdUnit4/bin/GdUnitCmdTool.gd \
|
|||
-a res://test
|
||||
```
|
||||
|
||||
Full suite: **254** cases, **0** orphans (GdUnit exit **0**).
|
||||
Full suite: **255** cases, **0** orphans (GdUnit exit **0**).
|
||||
|
||||
```bash
|
||||
# Focused NEO-122 / layout subset
|
||||
|
|
|
|||
Loading…
Reference in New Issue