2222
2323namespace Microsoft . MixedReality . Toolkit . Tests
2424{
25- public class FocusProviderTests
25+ public class FocusProviderTests : BasePlayModeTests
2626 {
27- [ UnitySetUp ]
28- public IEnumerator Setup ( )
29- {
30- PlayModeTestUtilities . Setup ( ) ;
31- yield return null ;
32- }
33-
34- [ UnityTearDown ]
35- public IEnumerator TearDown ( )
36- {
37- PlayModeTestUtilities . TearDown ( ) ;
38- yield return null ;
39- }
40-
4127 /// <summary>
4228 /// Test that the gaze cursor behaves properly with articulated hand pointers.
4329 /// </summary>
@@ -176,14 +162,13 @@ public IEnumerator TestGazeProviderTargetUnityUi()
176162 [ UnityTest ]
177163 public IEnumerator TestGazeProviderDestroyed ( )
178164 {
179- PlayModeTestUtilities . Setup ( ) ;
180165 yield return PlayModeTestUtilities . WaitForInputSystemUpdate ( ) ;
181166
182167 // remove the gaze provider and it's components from the scene
183168 GazeProvider gazeProvider = CoreServices . InputSystem . GazeProvider . GameObjectReference . GetComponent < GazeProvider > ( ) ;
184169 gazeProvider . GazePointer . BaseCursor . Destroy ( ) ;
185170 DebugUtilities . LogVerbose ( "Application was playing, destroyed the gaze pointer's BaseCursor" ) ;
186- UnityObjectExtensions . DestroyObject ( gazeProvider as Component ) ;
171+ UnityObjectExtensions . DestroyObject ( gazeProvider ) ;
187172 gazeProvider = null ;
188173
189174 // Ensure that the input system and it's related input sources are able to be reinitialized without issue.
@@ -201,8 +186,6 @@ public IEnumerator TestGazeProviderDestroyed()
201186 [ UnityTest ]
202187 public IEnumerator TestOverrideFocusDetails ( )
203188 {
204- PlayModeTestUtilities . Setup ( ) ;
205-
206189 var cube = GameObject . CreatePrimitive ( PrimitiveType . Cube ) ;
207190 yield return null ;
208191
@@ -218,10 +201,12 @@ public IEnumerator TestOverrideFocusDetails()
218201 Assert . IsTrue ( focusProvider . TryGetFocusDetails ( pointer , out focusDetails ) ) ;
219202 Assert . IsNull ( focusDetails . Object ) ;
220203
221- var newFocusDetails = new Physics . FocusDetails ( ) ;
222- newFocusDetails . Object = cube ;
223- newFocusDetails . RayDistance = 10 ;
224- newFocusDetails . Point = new Vector3 ( 1 , 2 , 3 ) ;
204+ var newFocusDetails = new Physics . FocusDetails
205+ {
206+ Object = cube ,
207+ RayDistance = 10 ,
208+ Point = new Vector3 ( 1 , 2 , 3 )
209+ } ;
225210 Assert . IsTrue ( focusProvider . TryOverrideFocusDetails ( pointer , newFocusDetails ) ) ;
226211
227212 Assert . IsTrue ( focusProvider . TryGetFocusDetails ( pointer , out focusDetails ) ) ;
0 commit comments