Files

77 lines
2.4 KiB
C#
Raw Permalink Normal View History

2021-12-05 04:18:30 +01:00
using Content.Server.Fluids.EntitySystems;
using Content.Shared.Chemistry.Components;
2021-06-09 22:19:39 +02:00
using Content.Shared.Coordinates;
using Content.Shared.FixedPoint;
2023-04-10 15:37:03 +10:00
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()
{
2023-08-25 02:56:51 +02:00
await using var pair = await PoolManager.GetServerClient();
var server = pair.Server;
var testMap = await pair.CreateTestMap();
2022-06-21 07:44:19 -07:00
var spillSystem = server.System<PuddleSystem>();
await server.WaitAssertion(() =>
{
var solution = new Solution("Water", FixedPoint2.New(20));
2022-06-21 07:44:19 -07:00
var tile = testMap.Tile;
var gridUid = tile.GridUid;
var (x, y) = tile.GridIndices;
var coordinates = new EntityCoordinates(gridUid, x, y);
Add test pooling (#4961) * Add test pooling * WIP test pooling changes * Fix Destructible tests * Don't pool unpooled or dummy ticker instances * Change ServerPathfindingDebugSystem to replace existing entries * Fix SaveLoadSaveTest comment * Don't pool StartTest * Comment out global setup * Fix puddle tests * Move SolarPanelComponent initialize to PowerSolarSystem OnMapInit * Update RobustToolbox * Finish fixing tests, make test threads background threads * Bring back pooling * Fix nullable * Update RobustToolbox * Set cvars on server return * Un-pool tests with custom cvars * Update RobustToolbox * Update RobustToolbox * Change where the main tile coordinates are * Remove DisposalUnitTest grid check * Fix test pooling being a fickle bitch * Fix EntitySystemExtensionsTest * Update RobustToolbox * Update RobustToolbox * Make nullable pool settings true * Update RobustToolbox * Wait other way around * We are unitystation now * Update RobustToolbox * Create global setup * Pool some more tests * Fix not properly disconnecting clients before restarting the round * Give more info on ran tests * Standardize default test cvars * Update RobustToolbox * Update RobustToolbox * Pool clients * Fix test order issue * Fix cvars in character creation test not being set properly * Update RobustToolbox * Update RobustToolbox * Rider shut * Update RobustToolbox * Format tests ran better * Update RobustToolbox * Reset RobustToolbox * Reset RobustToolbox harder * Fix one instance of test order causing destructible tests to fail
2021-11-06 11:49:59 +01:00
Assert.That(spillSystem.TrySpillAt(coordinates, solution, out _), Is.True);
});
await pair.RunTicksSync(5);
2023-08-25 02:56:51 +02:00
await pair.CleanReturnAsync();
}
[Test]
public async Task SpaceNoPuddleTest()
{
2023-08-25 02:56:51 +02:00
await using var pair = await PoolManager.GetServerClient();
var server = pair.Server;
Add test pooling (#4961) * Add test pooling * WIP test pooling changes * Fix Destructible tests * Don't pool unpooled or dummy ticker instances * Change ServerPathfindingDebugSystem to replace existing entries * Fix SaveLoadSaveTest comment * Don't pool StartTest * Comment out global setup * Fix puddle tests * Move SolarPanelComponent initialize to PowerSolarSystem OnMapInit * Update RobustToolbox * Finish fixing tests, make test threads background threads * Bring back pooling * Fix nullable * Update RobustToolbox * Set cvars on server return * Un-pool tests with custom cvars * Update RobustToolbox * Update RobustToolbox * Change where the main tile coordinates are * Remove DisposalUnitTest grid check * Fix test pooling being a fickle bitch * Fix EntitySystemExtensionsTest * Update RobustToolbox * Update RobustToolbox * Make nullable pool settings true * Update RobustToolbox * Wait other way around * We are unitystation now * Update RobustToolbox * Create global setup * Pool some more tests * Fix not properly disconnecting clients before restarting the round * Give more info on ran tests * Standardize default test cvars * Update RobustToolbox * Update RobustToolbox * Pool clients * Fix test order issue * Fix cvars in character creation test not being set properly * Update RobustToolbox * Update RobustToolbox * Rider shut * Update RobustToolbox * Format tests ran better * Update RobustToolbox * Reset RobustToolbox * Reset RobustToolbox harder * Fix one instance of test order causing destructible tests to fail
2021-11-06 11:49:59 +01:00
var testMap = await pair.CreateTestMap();
var grid = testMap.Grid;
2022-06-21 07:44:19 -07:00
2021-12-05 04:18:30 +01:00
var entitySystemManager = server.ResolveDependency<IEntitySystemManager>();
var spillSystem = server.System<PuddleSystem>();
var mapSystem = server.System<SharedMapSystem>();
Add test pooling (#4961) * Add test pooling * WIP test pooling changes * Fix Destructible tests * Don't pool unpooled or dummy ticker instances * Change ServerPathfindingDebugSystem to replace existing entries * Fix SaveLoadSaveTest comment * Don't pool StartTest * Comment out global setup * Fix puddle tests * Move SolarPanelComponent initialize to PowerSolarSystem OnMapInit * Update RobustToolbox * Finish fixing tests, make test threads background threads * Bring back pooling * Fix nullable * Update RobustToolbox * Set cvars on server return * Un-pool tests with custom cvars * Update RobustToolbox * Update RobustToolbox * Change where the main tile coordinates are * Remove DisposalUnitTest grid check * Fix test pooling being a fickle bitch * Fix EntitySystemExtensionsTest * Update RobustToolbox * Update RobustToolbox * Make nullable pool settings true * Update RobustToolbox * Wait other way around * We are unitystation now * Update RobustToolbox * Create global setup * Pool some more tests * Fix not properly disconnecting clients before restarting the round * Give more info on ran tests * Standardize default test cvars * Update RobustToolbox * Update RobustToolbox * Pool clients * Fix test order issue * Fix cvars in character creation test not being set properly * Update RobustToolbox * Update RobustToolbox * Rider shut * Update RobustToolbox * Format tests ran better * Update RobustToolbox * Reset RobustToolbox * Reset RobustToolbox harder * Fix one instance of test order causing destructible tests to fail
2021-11-06 11:49:59 +01:00
// 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);
});
2023-08-25 02:56:51 +02:00
await pair.CleanReturnAsync();
}
}
}