Hygiene B6b: convert leaky-world tests + HudSystem cosmetics
- 10 EditMode files: every bare trailing world.Dispose() now inside using(world){} (single-world) or a [TearDown]+List<World> (the multi-world reject-matrix tests in BoonApplyTests/RouteSelectSystemTests) — an assertion failure can no longer leak the World and mask the true first failure. No test logic changed.
- HudSystem: collapse the blank-line run before the class close; trim the extracted route-map clause from the READY-panel comment.
466/466 EditMode tests pass.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -92,6 +92,8 @@ namespace ProjectM.Tests
|
||||
public void Seeds_ByRoomDifficulty_AndSpawnsTaggedAtActiveSlotOrigin()
|
||||
{
|
||||
var (world, group, runDir, zoneDir) = MakeWorld(currentRoom: 0, currentNodeId: RunMap.NodeId(0, 0), activeSubSlot: 0);
|
||||
using (world)
|
||||
{
|
||||
var em = world.EntityManager;
|
||||
var map = RunMapMath.Generate(Seed);
|
||||
var plan = RoomLayoutMath.Plan(map.NodeAt(RunMap.NodeId(0, 0)), 0, map.LayerCount);
|
||||
@@ -120,7 +122,7 @@ namespace ProjectM.Tests
|
||||
Assert.LessOrEqual(math.distance(xfs[0].Position.xz, origin.xz), 14f + 0.01f,
|
||||
"ring-spawned around the ACTIVE sub-slot origin");
|
||||
xfs.Dispose(); regs.Dispose(); rooms.Dispose(); q.Dispose(); // dispose BEFORE the worldispose();
|
||||
world.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -129,6 +131,8 @@ namespace ProjectM.Tests
|
||||
var map = RunMapMath.Generate(Seed);
|
||||
int bossLayer = map.LayerCount - 1;
|
||||
var (world, group, runDir, zoneDir) = MakeWorld(bossLayer, map.BossNodeId, activeSubSlot: (byte)(bossLayer & 1));
|
||||
using (world)
|
||||
{
|
||||
var em = world.EntityManager;
|
||||
|
||||
group.Update(); // seed tick (the landing grace holds the boss)
|
||||
@@ -145,13 +149,15 @@ namespace ProjectM.Tests
|
||||
Assert.AreEqual(50f * Tuning.BossHealthMultiplier, hps[0].Max, 1e-3f, "boss health scaled");
|
||||
Assert.AreEqual(Tuning.BossScaleMultiplier, xfs[0].Scale, 1e-3f, "boss visual scale bumped");
|
||||
hps.Dispose(); xfs.Dispose(); q.Dispose(); // dispose BEFORE the world (a using-var here outlives it);
|
||||
world.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Objective_ClearedLatch_AndIdleOutsideRooms()
|
||||
{
|
||||
var (world, group, runDir, zoneDir) = MakeWorld(0, RunMap.NodeId(0, 0), 0);
|
||||
using (world)
|
||||
{
|
||||
var em = world.EntityManager;
|
||||
|
||||
// Fabricate a fully-spawned, fully-dead wave for the CURRENT room epoch.
|
||||
@@ -166,13 +172,15 @@ namespace ProjectM.Tests
|
||||
group.Update();
|
||||
Assert.AreEqual(ExpeditionObjectiveState.Idle, em.GetComponentData<ExpeditionObjective>(runDir).State,
|
||||
"no active room -> Idle (objective still written above the early-return)");
|
||||
world.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void MaxAlive_PackFitWaits_WithoutConsumingTheSlot()
|
||||
{
|
||||
var (world, group, runDir, zoneDir) = MakeWorld(0, RunMap.NodeId(0, 0), 0, maxAlive: 1);
|
||||
using (world)
|
||||
{
|
||||
var em = world.EntityManager;
|
||||
// One zone enemy already alive fills the cap.
|
||||
var blocker = em.CreateEntity(typeof(ZoneEnemyTag));
|
||||
@@ -184,7 +192,7 @@ namespace ProjectM.Tests
|
||||
var zs = em.GetComponentData<ZoneEnemyState>(zoneDir);
|
||||
Assert.AreEqual(1, Alive(em), "cap full -> nothing spawned");
|
||||
Assert.AreEqual(2, zs.RemainingToSpawn, "the slot WAITS (not consumed) until the pack fits");
|
||||
world.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user