Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8fca1cf

Browse files
authored
Removes unneeded tests and removes rooms from Tests (unitystation#11152)
1 parent abe9739 commit 8fca1cf

2 files changed

Lines changed: 2 additions & 146 deletions

File tree

UnityProject/Assets/Tests/Scenes/GeneralSceneTests.cs

Lines changed: 0 additions & 144 deletions
Original file line numberDiff line numberDiff line change
@@ -34,150 +34,6 @@ public GeneralSceneTests(SceneTestData data) : base(data)
3434
{
3535
}
3636

37-
/// <summary>
38-
/// Checks scenes for prefabs that have gone to 0,0 and another check for missing prefabs since the other component doesn't seem to work too well
39-
/// </summary>
40-
[Test]
41-
public void PrefabsAreNotAt00()
42-
{
43-
foreach (var layer in RootObjects.ComponentsInChildren<ObjectLayer>().NotNull())
44-
{
45-
foreach (Transform transform in layer.transform)
46-
{
47-
var localPos = transform.localPosition;
48-
var objName = transform.name;
49-
var message = $"Object: \"{transform.HierarchyName()}\"";
50-
Report.FailIf(objName.Contains("Missing Prefab"))
51-
.AppendLine($"{message} is missing prefab");
52-
}
53-
}
54-
55-
Report.AssertPassed();
56-
}
57-
58-
/// <summary>
59-
/// Checks to make sure all matrices have a matrix sync
60-
/// </summary>
61-
[Test]
62-
public void MatrixHasMatrixSyncAndIsCorrectParent()
63-
{
64-
using var pool = ListPool<MatrixSync>.Get(out var matrixSyncs);
65-
66-
foreach (var matrix in RootObjects.Select(go => go.GetComponent<NetworkedMatrix>()).NotNull())
67-
{
68-
matrix.GetComponentsInChildren(matrixSyncs);
69-
var matrixName = matrix.transform.HierarchyName();
70-
71-
Report.FailIf(matrixSyncs.Count, Is.EqualTo(0))
72-
.AppendLine($"\"{matrixName}\" is missing a MatrixSync, please add one")
73-
.FailIf(matrixSyncs.Count, Is.GreaterThan(1))
74-
.AppendLine($"\"{matrixName}\" has more than one MatrixSync, only one is allowed");
75-
76-
//Make sure matrix sync has correct parent
77-
foreach (var matrixSync in matrixSyncs)
78-
{
79-
var transform = matrixSync.transform;
80-
var parent = transform.parent;
81-
Report.FailIfNot(parent, Is.EqualTo(matrix.transform))
82-
.Append($"\"{matrixSync.name}\" is parented to \"{parent.transform.HierarchyName()}\" ")
83-
.Append($"when it should be parented to \"{matrixName}\"")
84-
.AppendLine();
85-
}
86-
}
87-
88-
Report.AssertPassed();
89-
}
90-
91-
92-
[Test]
93-
public void OffSetIsPresent0Dot5()
94-
{
95-
foreach (var RootObject in RootObjects)
96-
{
97-
if (RootObject.transform.childCount > 0)
98-
{
99-
var OffsetTransform = RootObject.transform.GetChild(0).localPosition;
100-
var Difference = OffsetTransform.RoundToInt() - OffsetTransform;
101-
102-
if (Mathf.Abs(Difference.x) != 0.5 || Mathf.Abs(Difference.y) != 0.5)
103-
{
104-
Report.Fail()
105-
.AppendLine($"{RootObject.name} Does not have a 0.5 offset on {RootObject.transform.GetChild(0).name}.");
106-
}
107-
}
108-
}
109-
Report.AssertPassed();
110-
}
111-
112-
[Test]
113-
public void LayersHaveCorrectParentAndAreNotDuplicated()
114-
{
115-
using var pool = HashSetPool<LayerType>.Get(out var layers);
116-
117-
foreach (var matrix in RootObjects.ComponentInChildren<Matrix>().NotNull())
118-
{
119-
layers.Clear();
120-
121-
foreach (var layer in matrix.GetComponentsInChildren<Layer>().NotNull())
122-
{
123-
var layerType = layer.LayerType;
124-
125-
if (layers.Contains(layerType))
126-
{
127-
Report.Fail()
128-
.AppendLine($"Two or more {layerType} exist on \"{matrix.name}\".");
129-
}
130-
else
131-
{
132-
layers.Add(layerType);
133-
}
134-
135-
Report.FailIf(layer.Matrix != matrix)
136-
.AppendLine($"{layer.name} is located in \"{matrix.name}\" but is bound to \"{layer.Matrix.name}\".")
137-
.FailIf(layer.transform.parent != matrix.transform)
138-
.Append($"{layer.name} is not a direct child of the \"{matrix.name}\" matrix. ")
139-
.Append($"Currently located at: {layer.transform.HierarchyName()}.")
140-
.AppendLine();
141-
142-
}
143-
}
144-
145-
Report.AssertPassed();
146-
}
147-
148-
[Test]
149-
public void MatrixHasAllLayers()
150-
{
151-
using var pool = HashSetPool<LayerType>.Get(out var layers);
152-
153-
var layersNeeded = new List<LayerType>
154-
{
155-
LayerType.Effects , LayerType.Walls, LayerType.Windows, LayerType.Grills, LayerType.Objects,
156-
LayerType.Tables, LayerType.Floors, LayerType.Underfloor, LayerType.Electrical, LayerType.Pipe,
157-
LayerType.Disposals, LayerType.Base
158-
};
159-
160-
foreach (var matrix in RootObjects.ComponentInChildren<Matrix>().NotNull())
161-
{
162-
layers.Clear();
163-
164-
foreach (var layer in matrix.GetComponentsInChildren<Layer>().NotNull())
165-
{
166-
var layerType = layer.LayerType;
167-
layers.Add(layerType);
168-
}
169-
170-
foreach (var layer in layersNeeded)
171-
{
172-
if(layers.Contains(layer)) continue;
173-
174-
Report.Fail()
175-
.AppendLine($"Matrix: \"{matrix.name}\" in scene: {matrix.gameObject.scene} is missing layer: {layer}.");
176-
}
177-
}
178-
179-
Report.AssertPassed();
180-
}
18137

18238
[Test]
18339
public void ItemStorageHasForcesSpawn()

UnityProject/Assets/Tests/Scenes/SceneTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ public record SceneTestData(string File, BluePrintType Type)
3333
[TestFixtureSource(typeof(SceneTest), nameof(Scenes))]
3434
public abstract class SceneTest
3535
{
36-
public static IEnumerable<SceneTestData> Scenes => Utils.NonDevScenes.Select(scene => new SceneTestData(scene, BluePrintType.Map))
37-
.Concat(Utils.RoomBlueprintScenes.Select(scene => new SceneTestData(scene, BluePrintType.Room)));
36+
public static IEnumerable<SceneTestData> Scenes => Utils.NonDevScenes.Select(scene => new SceneTestData(scene, BluePrintType.Map));
3837

3938
private List<GameObject> rootObjects;
4039

@@ -59,6 +58,7 @@ public void Setup()
5958
MapSaver.MapData mapData;
6059
if(Data.Type == BluePrintType.Map) mapData = JsonConvert.DeserializeObject<MapSaver.MapData>(AccessFile.Load(Data.File, FolderType.Maps));
6160
else mapData = JsonConvert.DeserializeObject<MapSaver.MapData>(AccessFile.Load(Data.File, FolderType.Rooms));
61+
//TODO: Make some way to handle all of the rooms
6262
//TODO: Rooms don't require all the same tests as full maps. Figure out which ones are redundant and skip them. That being said, rooms are only really 1s each
6363
//TODO: Consider Loading all rooms at once and doing one large check
6464

0 commit comments

Comments
 (0)