Tyre finding: the orphaned AtlasViewer cluster is now actually deleted (atlas_viewer, atlas_marker_overlay, atlas_descend_geometry, atlas_legend_panel — a sixth orphan found beyond the review list — atlas_generation_proxy, atlas_generation_state; ~2,497 lines), with reachability re-verified across preload/class_name/res:// strings, every .tscn, and the standalone companion app. Test suites triaged, not blanket-deleted: 5 pure AtlasOverlayColors tests relocated into test_atlas_window_colors, the live type-identity regression guard relocated into test_step_canvas_viewer, dead coverage deleted. A real harness gap surfaced during diligence and RULED, not patched: visual_scenarios/visual_capture golden shots call retired continuous-zoom API — no shim (would resurrect what D-255 kills); inventory recorded on re-scoped T-1157 (gate-invisible, manual targets only). Hoshe finding 1: decode_png_field now detects the [Error, PackedByteArray] bin-shape from messagepack.gd explicitly — a genuine msgpack bin payload decodes correctly instead of silently collapsing to [0,0]; test built from a real round-tripped bin decode. Hoshe finding 2: the hard zoom-out reset is wired — ascend at rung 0 with a drifted view triggers _reset_to_global (the restored HARD condition), behavioral tests through the real input path. Notes folded: refloat + edge-scroll test coverage, legend smoke suite, Vector2i narrowing-safety comment with computed headroom. gdlint clean on touched files; full client suite 3364/3364. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
71 lines
2.6 KiB
GDScript
71 lines
2.6 KiB
GDScript
## T-1182 tests: StepCanvasLegend — smoke coverage (PR #203 review, Hoshe
|
|
## note). Not the retired atlas_window_legend.gd's own richer suite (that
|
|
## file never had a dedicated test — its coverage lived entirely inside
|
|
## AtlasWindowViewer's own suites, now retired); this pins the panel's basic
|
|
## lifecycle/content contract directly.
|
|
class_name TestStepCanvasLegend
|
|
extends GdUnitTestSuite
|
|
|
|
const LegendScript := preload("res://ui/implant/apps/atlas/step_canvas/step_canvas_legend.gd")
|
|
|
|
|
|
func test_legend_starts_hidden_before_refresh() -> void:
|
|
var v: StepCanvasViewer = auto_free(StepCanvasViewer.new())
|
|
add_child(v)
|
|
var legend = LegendScript.new(v)
|
|
auto_free(legend)
|
|
assert_bool(legend.visible).is_false()
|
|
|
|
|
|
func test_refresh_makes_the_legend_visible_and_populates_content() -> void:
|
|
var v: StepCanvasViewer = auto_free(StepCanvasViewer.new())
|
|
add_child(v)
|
|
v.enter({"body_id": "GJ380c", "body_radius_km": 6238.4}, {})
|
|
var legend = LegendScript.new(v)
|
|
add_child(legend)
|
|
legend.refresh()
|
|
assert_bool(legend.visible).is_true()
|
|
assert_int(legend.get_implant_children().size()).override_failure_message(
|
|
"refresh() must populate at least the always-on morphology/glaciation sections"
|
|
).is_greater(0)
|
|
|
|
|
|
## refresh() is a no-op (does not crash) when the legend has no viewer —
|
|
## defensive guard against a construction-order mistake.
|
|
func test_refresh_without_a_viewer_does_not_crash() -> void:
|
|
var legend = LegendScript.new(null)
|
|
auto_free(legend)
|
|
legend.refresh()
|
|
assert_bool(legend.visible).is_false()
|
|
|
|
|
|
## Toggling a gen_* overlay on changes the legend's content (the active
|
|
## toggle section appears) without crashing — the same "no active toggle by
|
|
## default, one section per active toggle" contract the retired
|
|
## atlas_window_legend.gd's own refresh() doc described.
|
|
func test_refresh_reflects_the_active_overlay_toggle() -> void:
|
|
var v: StepCanvasViewer = auto_free(StepCanvasViewer.new())
|
|
add_child(v)
|
|
v.enter({"body_id": "GJ380c", "body_radius_km": 6238.4}, {})
|
|
var legend = LegendScript.new(v)
|
|
add_child(legend)
|
|
legend.refresh()
|
|
var rows_before: int = legend.get_implant_children().size()
|
|
|
|
v.set_overlay_visible("gen_dw_temp", true)
|
|
legend.refresh()
|
|
var rows_after: int = legend.get_implant_children().size()
|
|
|
|
assert_int(rows_after).override_failure_message(
|
|
"activating a toggle overlay must add its own legend section"
|
|
).is_greater(rows_before)
|
|
|
|
|
|
func test_reposition_sets_a_fixed_panel_margin_position() -> void:
|
|
var v: StepCanvasViewer = auto_free(StepCanvasViewer.new())
|
|
add_child(v)
|
|
var legend = LegendScript.new(v)
|
|
auto_free(legend)
|
|
legend.reposition()
|
|
assert_that(legend.position).is_equal(Vector2(LegendScript.PANEL_MARGIN, 60.0))
|