Rework Win2D editor layers
This commit is contained in:
@@ -41,6 +41,23 @@ public sealed class LevelEditorTests
|
||||
Assert.Equal(next.Leaks, rejected.Leaks);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ElectricityLeakAccessCyclesAcrossAdjacentFloorFaces()
|
||||
{
|
||||
var level = LevelState.Create("Electricity leak editor", 6, 6);
|
||||
level = level.SetTerrain(new(2, 2), ECellTerrain.Wall);
|
||||
level = level.SetTerrain(new(2, 1), ECellTerrain.Wall);
|
||||
level = LevelEditor.Apply(level, new(2, 2), new() { Tool = EEditorTool.Underground, Carrier = ECarrierType.Electricity });
|
||||
|
||||
var first = LevelEditor.CycleElectricityLeakAccess(level, new(2, 2));
|
||||
var second = LevelEditor.CycleElectricityLeakAccess(first, new(2, 2));
|
||||
|
||||
Assert.Single(first.Leaks);
|
||||
Assert.Equal(new(3, 2), first.Leaks[0].AccessPosition);
|
||||
Assert.Single(second.Leaks);
|
||||
Assert.Equal(new(2, 3), second.Leaks[0].AccessPosition);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReactorControlToolCreatesUnboundReactorState()
|
||||
{
|
||||
@@ -52,4 +69,27 @@ public sealed class LevelEditorTests
|
||||
Assert.Equal(new(2, 2), next.Reactors[0].ControlPosition);
|
||||
Assert.Equal(1, next.Reactors[0].ReactorId);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void MoveOccupantMovesRobotToFloorDestination()
|
||||
{
|
||||
var level = LevelState.Create("Move editor", 6, 6) with { Robot = new() { Position = new(1, 1) } };
|
||||
|
||||
var next = LevelEditor.MoveOccupant(level, new(1, 1), new(3, 3));
|
||||
|
||||
Assert.Equal(new(3, 3), next.Robot.Position);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void MoveOccupantMovesPropAndUpdatesReactorControlPosition()
|
||||
{
|
||||
var level = LevelState.Create("Move editor", 6, 6);
|
||||
level = LevelEditor.Apply(level, new(1, 1), new() { Tool = EEditorTool.ReactorControl });
|
||||
|
||||
var next = LevelEditor.MoveOccupant(level, new(1, 1), new(3, 3));
|
||||
|
||||
Assert.Equal(EPropType.None, next.GetProp(new(1, 1)).Type);
|
||||
Assert.Equal(EPropType.ReactorControl, next.GetProp(new(3, 3)).Type);
|
||||
Assert.Equal(new(3, 3), next.Reactors[0].ControlPosition);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user