Use PoolManager testmap for EntityTest (#21968)
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Numerics;
|
||||||
using Content.Server.Humanoid.Components;
|
using Content.Server.Humanoid.Components;
|
||||||
using Content.Shared.Coordinates;
|
using Content.Shared.Coordinates;
|
||||||
using Content.Shared.Prototypes;
|
using Content.Shared.Prototypes;
|
||||||
@@ -244,16 +245,11 @@ namespace Content.IntegrationTests.Tests
|
|||||||
.Select(p => p.ID)
|
.Select(p => p.ID)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
MapCoordinates coords = default;
|
var mapId = await pair.CreateTestMap();
|
||||||
await server.WaitPost(() =>
|
var coords = mapId.MapCoords;
|
||||||
{
|
|
||||||
var map = server.MapMan.CreateMap();
|
|
||||||
coords = new MapCoordinates(default, map);
|
|
||||||
});
|
|
||||||
|
|
||||||
await pair.RunTicksSync(3);
|
await pair.RunTicksSync(3);
|
||||||
|
|
||||||
List<string> badPrototypes = new();
|
|
||||||
foreach (var protoId in protoIds)
|
foreach (var protoId in protoIds)
|
||||||
{
|
{
|
||||||
// TODO fix ninja
|
// TODO fix ninja
|
||||||
@@ -270,27 +266,44 @@ namespace Content.IntegrationTests.Tests
|
|||||||
// If the entity deleted itself, check that it didn't spawn other entities
|
// If the entity deleted itself, check that it didn't spawn other entities
|
||||||
if (!server.EntMan.EntityExists(uid))
|
if (!server.EntMan.EntityExists(uid))
|
||||||
{
|
{
|
||||||
if (server.EntMan.EntityCount != count || client.EntMan.EntityCount != clientCount)
|
if (server.EntMan.EntityCount != count)
|
||||||
badPrototypes.Add(protoId);
|
{
|
||||||
|
Assert.Fail($"Server prototype {protoId} failed on deleting itself");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (client.EntMan.EntityCount != clientCount)
|
||||||
|
{
|
||||||
|
Assert.Fail($"Client prototype {protoId} failed on deleting itself");
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check that the number of entities has increased.
|
// Check that the number of entities has increased.
|
||||||
if (server.EntMan.EntityCount <= count || client.EntMan.EntityCount <= clientCount)
|
if (server.EntMan.EntityCount <= count)
|
||||||
{
|
{
|
||||||
badPrototypes.Add(protoId);
|
Assert.Fail($"Server prototype {protoId} failed on spawning as entity count didn't increase");
|
||||||
continue;
|
}
|
||||||
|
|
||||||
|
if (client.EntMan.EntityCount <= clientCount)
|
||||||
|
{
|
||||||
|
Assert.Fail($"Client prototype {protoId} failed on spawning as entity count didn't increase");
|
||||||
}
|
}
|
||||||
|
|
||||||
await server.WaitPost(() => server.EntMan.DeleteEntity(uid));
|
await server.WaitPost(() => server.EntMan.DeleteEntity(uid));
|
||||||
await pair.RunTicksSync(3);
|
await pair.RunTicksSync(3);
|
||||||
|
|
||||||
// Check that the number of entities has gone back to the original value.
|
// Check that the number of entities has gone back to the original value.
|
||||||
if (server.EntMan.EntityCount != count || client.EntMan.EntityCount != clientCount)
|
if (server.EntMan.EntityCount != count)
|
||||||
badPrototypes.Add(protoId);
|
{
|
||||||
|
Assert.Fail($"Server prototype {protoId} failed on deletion count didn't reset properly");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (client.EntMan.EntityCount != clientCount)
|
||||||
|
{
|
||||||
|
Assert.Fail($"Client prototype {protoId} failed on deletion count didn't reset properly");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.That(badPrototypes, Is.Empty);
|
|
||||||
await pair.CleanReturnAsync();
|
await pair.CleanReturnAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user