fix: TileRegistry floor-range warning, GroupViewsByFloor tests, stopwatch cleanup
This commit is contained in:
@@ -39,11 +39,31 @@ namespace DecayGrid.Tests
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TryGetView_ReturnsFalse_WhenNoViewRegistered()
|
||||
public void TryGetView_ReturnsFalse_WhenTileHasNoView()
|
||||
{
|
||||
var tile = new Tile("0_0_0", 0, 0.5f, 2f);
|
||||
_registry.Register(tile); // no view
|
||||
Assert.IsFalse(_registry.TryGetView("0_0_0", out _));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GroupViewsByFloor_PlacesTileOnCorrectFloor()
|
||||
{
|
||||
// Can't create TileViewAdapter in EditMode (MonoBehaviour), so just verify tile with no view doesn't crash
|
||||
var tile = new Tile("1_5_5", 1, 0.5f, 2f);
|
||||
_registry.Register(tile); // no view
|
||||
var floors = _registry.GroupViewsByFloor(3);
|
||||
Assert.AreEqual(3, floors.Count);
|
||||
// Tile has no view registered, so no view should appear in any floor
|
||||
Assert.AreEqual(0, floors[1].Count);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GroupViewsByFloor_OutOfRangeTile_DoesNotThrow()
|
||||
{
|
||||
var tile = new Tile("5_0_0", 5, 0.5f, 2f); // floor 5, but only 3 floors
|
||||
_registry.Register(tile);
|
||||
Assert.DoesNotThrow(() => _registry.GroupViewsByFloor(3));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user