Files
Tayrtahn cfc0247e5c Code Cleanup: Integration Tests (#29584)
* Cleanup PuddleTest

* Cleanup GravityGridTest

* Cleanup PowerTest

* Cleanup SaveLoadMapTest

* Cleanup Body tests

* Cleanup ContainerOcclusionTest

* Cleanup AirlockTest

* Cleanup DamageableTest

* Cleanup EntityTest

* Cleanup FluidSpillTest

* Cleanup FollowerSystemTest

* Cleanup HandCuffTest

* Cleanup InteractionSystemTests

* Cleanup InRangeUnobstructed

* Cleanup SimplePredictReconcileTest

* Cleanup PostMapInitTest

* Cleanup SalvageTest

* Cleanup SaveLoadSaveTest

* Cleanup ShuttleTest

* Cleanup MaterialArbitrageTest

* Cleanup PrototypeSaveTest

* Fix ShuttleTest

* Bunch of small ones

* Move JobTests to Station directory

* More small fixes

* Cleanup InteractionTest.Helpers
Had to change a method signature, so some callers were modified too.

* Missed one
2024-07-03 10:01:37 +10:00

77 lines
2.4 KiB
C#

using Content.Server.Fluids.EntitySystems;
using Content.Shared.Chemistry.Components;
using Content.Shared.Coordinates;
using Content.Shared.FixedPoint;
using Content.Shared.Fluids.Components;
using Robust.Shared.GameObjects;
using Robust.Shared.Map;
namespace Content.IntegrationTests.Tests.Fluids
{
[TestFixture]
[TestOf(typeof(PuddleComponent))]
public sealed class PuddleTest
{
[Test]
public async Task TilePuddleTest()
{
await using var pair = await PoolManager.GetServerClient();
var server = pair.Server;
var testMap = await pair.CreateTestMap();
var spillSystem = server.System<PuddleSystem>();
await server.WaitAssertion(() =>
{
var solution = new Solution("Water", FixedPoint2.New(20));
var tile = testMap.Tile;
var gridUid = tile.GridUid;
var (x, y) = tile.GridIndices;
var coordinates = new EntityCoordinates(gridUid, x, y);
Assert.That(spillSystem.TrySpillAt(coordinates, solution, out _), Is.True);
});
await pair.RunTicksSync(5);
await pair.CleanReturnAsync();
}
[Test]
public async Task SpaceNoPuddleTest()
{
await using var pair = await PoolManager.GetServerClient();
var server = pair.Server;
var testMap = await pair.CreateTestMap();
var grid = testMap.Grid;
var entitySystemManager = server.ResolveDependency<IEntitySystemManager>();
var spillSystem = server.System<PuddleSystem>();
var mapSystem = server.System<SharedMapSystem>();
// Remove all tiles
await server.WaitPost(() =>
{
var tiles = mapSystem.GetAllTiles(grid.Owner, grid.Comp);
foreach (var tile in tiles)
{
mapSystem.SetTile(grid, tile.GridIndices, Tile.Empty);
}
});
await pair.RunTicksSync(5);
await server.WaitAssertion(() =>
{
var coordinates = grid.Owner.ToCoordinates();
var solution = new Solution("Water", FixedPoint2.New(20));
Assert.That(spillSystem.TrySpillAt(coordinates, solution, out _), Is.False);
});
await pair.CleanReturnAsync();
}
}
}