test(@projects/@magic-civilization): 🐛 update stale sprite tests for shipped demo city art
Demo art now ships city_q1..q5.png, so _get_city_sprite resolves for every real quality — the "empty sprites/ dir → null" premise is obsolete. Test the null-fallback contract via a guaranteed-absent key (city_q99.png), and assert the add_city path resolves the demo sprite (procedural baseline still drawn underneath per the additive-overlay rule). GUT: test_sprite_rendering_capability 4 → 0 (720 passing / 7 failing). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
4e26e14066
commit
2d15605230
1 changed files with 14 additions and 11 deletions
|
|
@ -172,12 +172,14 @@ func test_unit_sync_queues_redraw_without_sprites() -> void:
|
|||
|
||||
# ── City rendering: baseline never removed ───────────────────────────
|
||||
|
||||
func test_city_sprite_lookup_returns_null_when_no_files_exist() -> void:
|
||||
var city: CityScript = _build_city("ironhold", 3, 0)
|
||||
var sprite: Texture2D = _city_renderer._get_city_sprite(city)
|
||||
func test_city_sprite_lookup_returns_null_for_missing_file() -> void:
|
||||
# Demo art now ships city_q1..q5.png, so _get_city_sprite resolves for real
|
||||
# qualities. The null-fallback contract (→ caller draws the procedural
|
||||
# baseline) is exercised here with a guaranteed-absent sprite key.
|
||||
var sprite: Texture2D = _city_renderer._load_cached_sprite("sprites/cities/city_q99.png")
|
||||
assert_null(
|
||||
sprite,
|
||||
"with empty sprites/ dir, city sprite lookup must return null",
|
||||
"an absent city sprite must return null (caller draws procedural baseline)",
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -196,21 +198,22 @@ func test_city_population_to_quality_bucket_respects_named_bounds() -> void:
|
|||
)
|
||||
|
||||
|
||||
func test_city_add_queues_redraw_without_sprites() -> void:
|
||||
# With zero sprites on disk, add_city must register the city and leave
|
||||
# the renderer ready to draw its procedural baseline (circle + outline
|
||||
# + name letter + HP bar + cultural borders). Direct _draw() calls are
|
||||
# not safe outside the engine's draw cycle.
|
||||
func test_city_add_registers_city_and_resolves_sprite() -> void:
|
||||
# add_city must register the city and leave the renderer ready to draw its
|
||||
# procedural baseline (circle + outline + name letter + HP bar + cultural
|
||||
# borders). Direct _draw() calls are not safe outside the engine draw cycle.
|
||||
var city: CityScript = _build_city("ironhold", 3, 0)
|
||||
_city_renderer.add_city(city)
|
||||
assert_true(
|
||||
_city_renderer._cities.has("ironhold"),
|
||||
"add_city must register the city regardless of sprite presence",
|
||||
)
|
||||
# Demo art ships city sprites for every quality, so the lookup resolves; the
|
||||
# procedural baseline is still drawn underneath (additive-overlay rule).
|
||||
var sprite: Texture2D = _city_renderer._get_city_sprite(city)
|
||||
assert_null(
|
||||
assert_not_null(
|
||||
sprite,
|
||||
"with zero sprites on disk, city sprite lookup returns null",
|
||||
"city sprite resolves from shipped demo art (procedural baseline drawn underneath)",
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue