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

View File

@@ -1,10 +1,8 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Content.Client;
using Content.Client.Entry;
using NUnit.Framework; using NUnit.Framework;
using Robust.Shared.ContentPack; using Robust.Shared.ContentPack;
using Robust.Shared.GameObjects; using Robust.Shared.GameObjects;
@@ -14,12 +12,12 @@ using YamlDotNet.RepresentationModel;
namespace Content.IntegrationTests.Tests.GameObjects.Components namespace Content.IntegrationTests.Tests.GameObjects.Components
{ {
[TestFixture] [TestFixture]
[TestOf(typeof(IgnoredComponents))] [TestOf(typeof(Client.Entry.IgnoredComponents))]
[TestOf(typeof(Server.Entry.IgnoredComponents))] [TestOf(typeof(Server.Entry.IgnoredComponents))]
public class EntityPrototypeComponentsTest : ContentIntegrationTest public class EntityPrototypeComponentsTest : ContentIntegrationTest
{ {
[Test] [Test]
public async Task Test() public async Task PrototypesHaveKnownComponents()
{ {
var (client, server) = await StartConnectedServerDummyTickerClientPair(); var (client, server) = await StartConnectedServerDummyTickerClientPair();
@@ -118,5 +116,40 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components
Assert.Fail(message.ToString()); 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", "ItemStatus",
"Marker", "Marker",
"Clickable", "Clickable",
"RadiatingLight",
"Icon", "Icon",
"ClientEntitySpawner", "ClientEntitySpawner",
"ToySingularity",
"CharacterInfo" "CharacterInfo"
}; };
} }