From 2d15605230f2efef7c8c4758f109d4d494834e46 Mon Sep 17 00:00:00 2001 From: Natalie Date: Wed, 24 Jun 2026 05:08:43 -0400 Subject: [PATCH] =?UTF-8?q?test(@projects/@magic-civilization):=20?= =?UTF-8?q?=F0=9F=90=9B=20update=20stale=20sprite=20tests=20for=20shipped?= =?UTF-8?q?=20demo=20city=20art?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- .../unit/test_sprite_rendering_capability.gd | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/game/engine/tests/unit/test_sprite_rendering_capability.gd b/src/game/engine/tests/unit/test_sprite_rendering_capability.gd index 4851c914..bd31a722 100644 --- a/src/game/engine/tests/unit/test_sprite_rendering_capability.gd +++ b/src/game/engine/tests/unit/test_sprite_rendering_capability.gd @@ -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)", )