@@ -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 ( )
0 commit comments