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
This commit is contained in:
Tayrtahn
2024-07-02 20:01:37 -04:00
committed by GitHub
parent 58d46ddd46
commit cfc0247e5c
56 changed files with 510 additions and 491 deletions

View File

@@ -51,11 +51,12 @@ namespace Content.IntegrationTests.Tests.Networking
PredictionTestComponent clientComponent = default!;
var serverSystem = sEntityManager.System<PredictionTestEntitySystem>();
var clientSystem = cEntityManager.System<PredictionTestEntitySystem>();
var sMapSys = sEntityManager.System<SharedMapSystem>();
await server.WaitPost(() =>
{
// Spawn dummy component entity.
var map = sMapManager.CreateMap();
sMapSys.CreateMap(out var map);
serverEnt = sEntityManager.SpawnEntity(null, new MapCoordinates(new Vector2(0, 0), map));
serverComponent = sEntityManager.AddComponent<PredictionTestComponent>(serverEnt);
});
@@ -67,7 +68,7 @@ namespace Content.IntegrationTests.Tests.Networking
Assert.That(sGameTiming.TickTimingAdjustment, Is.EqualTo(0));
// Check client buffer is full
Assert.That(cGameStateManager.CurrentBufferSize, Is.EqualTo(cGameStateManager.TargetBufferSize));
Assert.That(cGameStateManager.GetApplicableStateCount(), Is.EqualTo(cGameStateManager.TargetBufferSize));
Assert.That(cGameStateManager.TargetBufferSize, Is.EqualTo(2));
// This isn't required anymore, but the test had this for the sake of "technical things", and I cbf shifting
@@ -99,7 +100,7 @@ namespace Content.IntegrationTests.Tests.Networking
// Client last ran tick 15 meaning it's ahead of the last server tick it processed (12)
Assert.That(cGameTiming.CurTick, Is.EqualTo(expected));
Assert.That(cGameTiming.LastProcessedTick, Is.EqualTo(new GameTick((uint)(baseTick - cGameStateManager.TargetBufferSize))));
Assert.That(cGameTiming.LastProcessedTick, Is.EqualTo(new GameTick((uint) (baseTick - cGameStateManager.TargetBufferSize))));
});
// *** I am using block scopes to visually distinguish these sections of the test to make it more readable.
@@ -264,7 +265,7 @@ namespace Content.IntegrationTests.Tests.Networking
// Assert timing is still correct.
Assert.That(sGameTiming.CurTick, Is.EqualTo(new GameTick(baseTick + 8)));
Assert.That(cGameTiming.CurTick, Is.EqualTo(new GameTick(baseTick + 8 + delta)));
Assert.That(cGameTiming.LastProcessedTick, Is.EqualTo(new GameTick((uint)(baseTick + 8 - cGameStateManager.TargetBufferSize))));
Assert.That(cGameTiming.LastProcessedTick, Is.EqualTo(new GameTick((uint) (baseTick + 8 - cGameStateManager.TargetBufferSize))));
});
{