Test ignored component names (#6308)

This commit is contained in:
wrexbe
2022-01-25 21:41:28 -08:00
committed by GitHub
parent e5b32e0ef0
commit b2229a951d
3 changed files with 38 additions and 41 deletions

View File

@@ -9,7 +9,6 @@ namespace Content.Client.Entry
"AmmoBox",
"Pickaxe",
"IngestionBlocker",
"Interactable",
"Charger",
"CloningPod",
"Destructible",
@@ -54,13 +53,10 @@ namespace Content.Client.Entry
"DeployableBarrier",
"MagicMirror",
"FloorTile",
"ShuttleController",
"RandomInsulation",
"Electrified",
"Electrocution",
"Pourable",
"Paper",
"Write",
"Bloodstream",
"TransformableContainer",
"Mind",
@@ -71,7 +67,6 @@ namespace Content.Client.Entry
"BatterySelfRecharger",
"Puddle",
"Stomach",
"CanSpill",
"SpeedLoader",
"Hitscan",
"StunOnCollide",
@@ -79,9 +74,7 @@ namespace Content.Client.Entry
"Brain",
"CommunicationsConsole",
"BarSign",
"DroppedBodyPart",
"DoorBumpOpener",
"DroppedMechanism",
"SolarPanel",
"BodyScanner",
"Stunbaton",
@@ -93,7 +86,6 @@ namespace Content.Client.Entry
"DamageOnToolInteract",
"ExaminableBattery",
"PottedPlantHide",
"SecureEntityStorage",
"Lock",
"PresetIdCard",
"SolarControlConsole",
@@ -118,18 +110,14 @@ namespace Content.Client.Entry
"ApcPowerReceiver",
"Cable",
"StressTestMovement",
"Toys",
"EmitSoundOnThrow",
"Salvage",
"SalvageMagnet",
"Flash",
"Docking",
"Telecrystal",
"TrashSpawner",
"RCD",
"RCDAmmo",
"CursedEntityStorage",
"Listening",
"Radio",
"DisposalHolder",
"DisposalTagger",
@@ -154,8 +142,6 @@ namespace Content.Client.Entry
"DrawableSolution",
"InjectableSolution",
"Barotrauma",
"GasSprayer",
"GasVapor",
"GasVentPump",
"GasPassiveVent",
"GasVentScrubber",
@@ -173,11 +159,6 @@ namespace Content.Client.Entry
"AMEPart",
"AMEFuelContainer",
"AMEShield",
"PressurePump",
"PressureVent",
"VolumePump",
"PressureSiphon",
"PipeHeater",
"AtmosDevice",
"SignalReceiver",
"SignalSwitch",
@@ -200,7 +181,6 @@ namespace Content.Client.Entry
"Headset",
"ComputerBoard",
"GasCanister",
"GasCanisterPort",
"GasPort",
"GasPortable",
"AtmosPipeColor",
@@ -212,12 +192,9 @@ namespace Content.Client.Entry
"SeedExtractor",
"Produce",
"Log",
"Hoe",
"Seed",
"ActivatableUI",
"ActivatableUIRequiresPower",
"BotanySharp",
"PlantSampleTaker",
"Internals",
"GasTank",
"BreathMask",
@@ -235,14 +212,10 @@ namespace Content.Client.Entry
"MorgueTray",
"CrematoriumEntityStorage",
"RandomSpriteState",
"DebugEquip",
"InnateActions",
"ReagentGrinder",
"Extractable",
"WelderRefinable",
"ConveyorAssembly",
"TwoWayLever",
"FirelockElectronics",
"SolutionInjectOnCollide",
"Machine",
"MachinePart",
@@ -251,7 +224,6 @@ namespace Content.Client.Entry
"ChemicalAmmo",
"CargoTelepad",
"TraitorDeathMatchRedemption",
"GlassBeaker",
"CanHostGuardian",
"SliceableFood",
"DamageOtherOnHit",
@@ -266,20 +238,14 @@ namespace Content.Client.Entry
"Toilet",
"ClusterFlash",
"Repairable",
"GasGenerator",
"SolutionTransfer",
"Evaporation",
"Shovel",
"ReagentTank",
"UtilityAI",
"MouseAccent",
"FlashImmunity",
"GhostTakeoverAvailable",
"GhostRoleMobSpawner",
"GhostOnMove",
"BedsheetSpawner",
"ToySpawner",
"FigureSpawner",
"RandomSpawner",
"SpawnAfterInteract",
"DisassembleOnActivate",

View File

@@ -1,10 +1,8 @@
using System.Collections.Generic;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Content.Client;
using Content.Client.Entry;
using NUnit.Framework;
using Robust.Shared.ContentPack;
using Robust.Shared.GameObjects;
@@ -14,12 +12,12 @@ using YamlDotNet.RepresentationModel;
namespace Content.IntegrationTests.Tests.GameObjects.Components
{
[TestFixture]
[TestOf(typeof(IgnoredComponents))]
[TestOf(typeof(Client.Entry.IgnoredComponents))]
[TestOf(typeof(Server.Entry.IgnoredComponents))]
public class EntityPrototypeComponentsTest : ContentIntegrationTest
{
[Test]
public async Task Test()
public async Task PrototypesHaveKnownComponents()
{
var (client, server) = await StartConnectedServerDummyTickerClientPair();
@@ -118,5 +116,40 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components
Assert.Fail(message.ToString());
}
[Test]
public async Task IgnoredComponentsExistInTheCorrectPlaces()
{
var (client, server) = await StartConnectedServerClientPair();
var serverComponents = server.ResolveDependency<IComponentFactory>();
var ignoredServerNames = Server.Entry.IgnoredComponents.List;
var clientComponents = client.ResolveDependency<IComponentFactory>();
var ignoredClientNames = Client.Entry.IgnoredComponents.List;
var failureMessages = "";
foreach (var clientIgnored in ignoredClientNames)
{
if (clientComponents.TryGetRegistration(clientIgnored, out _))
{
failureMessages = $"{failureMessages}\nComponent {clientIgnored} was ignored on client, but exists on client";
}
if (!serverComponents.TryGetRegistration(clientIgnored, out _))
{
failureMessages = $"{failureMessages}\nComponent {clientIgnored} was ignored on client, but does not exist on server";
}
}
foreach (var serverIgnored in ignoredServerNames)
{
if (serverComponents.TryGetRegistration(serverIgnored, out _))
{
failureMessages = $"{failureMessages}\nComponent {serverIgnored} was ignored on server, but exists on server";
}
if (!clientComponents.TryGetRegistration(serverIgnored, out _))
{
failureMessages = $"{failureMessages}\nComponent {serverIgnored} was ignored on server, but does not exist on client";
}
}
Assert.IsEmpty(failureMessages);
}
}
}

View File

@@ -13,10 +13,8 @@ namespace Content.Server.Entry
"ItemStatus",
"Marker",
"Clickable",
"RadiatingLight",
"Icon",
"ClientEntitySpawner",
"ToySingularity",
"CharacterInfo"
};
}