test(@projects/@magic-civilization): 🐛 fix stale minimap fog-colour consts + traded_luxuries typed-array assigns
- test_minimap read MinimapScript.FOG_COLOR / UNEXPLORED_COLOR, but p2-87 moved
those to ThemeAssets.color("fog.explored"/"fog.unexplored") instance vars.
Read the tokens directly (same source minimap.gd uses).
- test_save_load assigned untyped array literals to Player.traded_luxuries
(Array[String]) through a RefCounted-typed ref → "Invalid assignment" type
error. Use typed Array[String] locals.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
2211df0d85
commit
3d32482acc
2 changed files with 9 additions and 5 deletions
|
|
@ -26,7 +26,8 @@ func after_each() -> void:
|
|||
|
||||
func test_traded_luxuries_round_trips() -> void:
|
||||
var p0: RefCounted = GameState.players[0]
|
||||
p0.traded_luxuries = ["silk", "spices", "wine"]
|
||||
var lux0: Array[String] = ["silk", "spices", "wine"]
|
||||
p0.traded_luxuries = lux0
|
||||
|
||||
SaveManagerScript.save_game(0)
|
||||
GameState.players[0].traded_luxuries = []
|
||||
|
|
@ -42,7 +43,8 @@ func test_traded_luxuries_empty_round_trips() -> void:
|
|||
p0.traded_luxuries = []
|
||||
|
||||
SaveManagerScript.save_game(0)
|
||||
GameState.players[0].traded_luxuries = ["iron"]
|
||||
var lux_iron: Array[String] = ["iron"]
|
||||
GameState.players[0].traded_luxuries = lux_iron
|
||||
|
||||
var err: Error = SaveManagerScript.load_game(0)
|
||||
assert_eq(err, OK, "load_game must succeed")
|
||||
|
|
@ -137,7 +139,8 @@ func test_wonders_built_empty_round_trips() -> void:
|
|||
|
||||
func test_all_new_fields_round_trip_together() -> void:
|
||||
var p0: RefCounted = GameState.players[0]
|
||||
p0.traded_luxuries = ["mithril_ore", "deepstone"]
|
||||
var lux_m: Array[String] = ["mithril_ore", "deepstone"]
|
||||
p0.traded_luxuries = lux_m
|
||||
p0.clan_id = "goldvein"
|
||||
GameState.wonders_built = {"world_pillar": 0}
|
||||
GameState.diplomacy = {"0_1": "peace"}
|
||||
|
|
|
|||
|
|
@ -34,8 +34,9 @@ func test_minimap_has_fog_state_triangulation() -> void:
|
|||
assert_true(mm.has_method("_get_tile_visibility"),
|
||||
"_get_tile_visibility() must triangulate fog state per tile")
|
||||
mm.free()
|
||||
var fog: Color = MinimapScript.FOG_COLOR
|
||||
var unexplored: Color = MinimapScript.UNEXPLORED_COLOR
|
||||
# minimap.gd sources fog colours from ThemeAssets tokens (p2-87), not consts.
|
||||
var fog: Color = ThemeAssets.color("fog.explored")
|
||||
var unexplored: Color = ThemeAssets.color("fog.unexplored")
|
||||
assert_ne(fog, unexplored,
|
||||
"Seen-stale (FOG_COLOR) must render distinct from unexplored (UNEXPLORED_COLOR)")
|
||||
assert_lt(fog.a, unexplored.a,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue