File tree Expand file tree Collapse file tree 5 files changed +16
-56
lines changed
Assets/MRTK/Tests/PlayModeTests Expand file tree Collapse file tree 5 files changed +16
-56
lines changed Original file line number Diff line number Diff line change 22
22
namespace Microsoft . MixedReality . Toolkit . Tests
23
23
{
24
24
// Tests to verify that cursor state is updated correctly
25
- public class BaseCursorTests
25
+ public class BaseCursorTests : BasePlayModeTests
26
26
{
27
27
// Keeping this low by default so the test runs fast. Increase it to be able to see hand movements in the editor.
28
28
private const int numFramesPerMove = 1 ;
@@ -41,10 +41,10 @@ public class BaseCursorTests
41
41
/// for examples.
42
42
/// See also comments at <see cref="TestUtilities.PlayspaceToArbitraryPose"/>.
43
43
/// </remarks>
44
- [ UnitySetUp ]
45
- public IEnumerator SetUp ( )
44
+ public override IEnumerator Setup ( )
46
45
{
47
- PlayModeTestUtilities . Setup ( ) ;
46
+ yield return base . Setup ( ) ;
47
+
48
48
TestUtilities . PlayspaceToArbitraryPose ( ) ;
49
49
50
50
// Target frame rate is set to 50 to match the physics
@@ -69,12 +69,10 @@ public IEnumerator SetUp()
69
69
yield return null ;
70
70
}
71
71
72
- [ UnityTearDown ]
73
- public IEnumerator TearDown ( )
72
+ public override IEnumerator TearDown ( )
74
73
{
75
74
Object . Destroy ( cube ) ;
76
- TestUtilities . ShutdownMixedRealityToolkit ( ) ;
77
- yield return null ;
75
+ yield return base . TearDown ( ) ;
78
76
}
79
77
80
78
private void VerifyCursorStateFromPointers ( IEnumerable < IMixedRealityPointer > pointers , CursorStateEnum state )
Original file line number Diff line number Diff line change @@ -31,22 +31,8 @@ namespace Microsoft.MixedReality.Toolkit.Tests
31
31
/// (i.e. input and diagnostics are used, but any arbitrary systems that can raise events on demand
32
32
/// would work)
33
33
/// </remarks>
34
- class BaseEventSystemTests
34
+ internal class BaseEventSystemTests : BasePlayModeTests
35
35
{
36
- [ UnitySetUp ]
37
- public IEnumerator Setup ( )
38
- {
39
- PlayModeTestUtilities . Setup ( ) ;
40
- yield return null ;
41
- }
42
-
43
- [ UnityTearDown ]
44
- public IEnumerator TearDown ( )
45
- {
46
- PlayModeTestUtilities . TearDown ( ) ;
47
- yield return null ;
48
- }
49
-
50
36
/// <summary>
51
37
/// Test input system catches exception thrown in global listener responding to input event, and
52
38
/// that the input system is still able to unregister the event listener (i.e. eventExecutionDepth
Original file line number Diff line number Diff line change @@ -27,32 +27,24 @@ namespace Microsoft.MixedReality.Toolkit.Tests
27
27
/// <summary>
28
28
/// Tests for runtime behavior of bounds control
29
29
/// </summary>
30
- public class BoundsControlTests
30
+ public class BoundsControlTests : BasePlayModeTests
31
31
{
32
32
private Material testMaterial ;
33
33
private Material testMaterialGrabbed ;
34
34
35
35
#region Utilities
36
- [ UnitySetUp ]
37
- public IEnumerator Setup ( )
38
- {
39
- PlayModeTestUtilities . Setup ( ) ;
40
36
37
+ public override IEnumerator Setup ( )
38
+ {
41
39
// create shared test materials
42
40
var shader = StandardShaderUtility . MrtkStandardShader ;
43
41
testMaterial = new Material ( shader ) ;
44
42
testMaterial . color = Color . yellow ;
45
43
46
44
testMaterialGrabbed = new Material ( shader ) ;
47
45
testMaterialGrabbed . color = Color . green ;
48
- yield return null ;
49
- }
50
46
51
- [ UnityTearDown ]
52
- public IEnumerator TearDown ( )
53
- {
54
- PlayModeTestUtilities . TearDown ( ) ;
55
- yield return null ;
47
+ yield return base . Setup ( ) ;
56
48
}
57
49
58
50
private readonly Vector3 boundsControlStartCenter = Vector3 . forward * 1.5f ;
Original file line number Diff line number Diff line change 12
12
13
13
using Microsoft . MixedReality . Toolkit . Input ;
14
14
using Microsoft . MixedReality . Toolkit . Utilities ;
15
- using NUnit . Framework ;
16
15
using System . Collections ;
17
16
using UnityEngine ;
18
17
using UnityEngine . EventSystems ;
19
18
using UnityEngine . TestTools ;
20
19
21
20
namespace Microsoft . MixedReality . Toolkit . Tests
22
21
{
23
- public class BaseHandVisualizerTests
22
+ public class BaseHandVisualizerTests : BasePlayModeTests
24
23
{
25
24
/// <summary>
26
25
/// A mock IMixedRealityInputSource, used to test BaseHandVisualizer::OnHandMeshUpdated.
@@ -71,20 +70,6 @@ private class MockController : IMixedRealityController
71
70
public bool IsInPointingPose => throw new System . NotImplementedException ( ) ;
72
71
}
73
72
74
- [ UnitySetUp ]
75
- public IEnumerator Setup ( )
76
- {
77
- PlayModeTestUtilities . Setup ( ) ;
78
- yield return null ;
79
- }
80
-
81
- [ UnityTearDown ]
82
- public IEnumerator TearDown ( )
83
- {
84
- TestUtilities . ShutdownMixedRealityToolkit ( ) ;
85
- yield return null ;
86
- }
87
-
88
73
/// <summary>
89
74
/// Validates that OnHandMeshUpdated can be called with hand mesh vertices of different
90
75
/// lengths and not crash.
Original file line number Diff line number Diff line change 15
15
using NUnit . Framework ;
16
16
using System . Collections ;
17
17
using UnityEditor ;
18
- using UnityEngine ;
19
18
using UnityEngine . TestTools ;
20
19
21
20
namespace Microsoft . MixedReality . Toolkit . Tests
@@ -117,9 +116,9 @@ public IEnumerator TestManualStartObserver()
117
116
public IEnumerator TestDisableSpatialAwarenessSystem ( )
118
117
{
119
118
var mrtkProfile = CreateMRTKTestProfile ( TestSpatialAwarenessSystemProfilePath ) ;
120
-
119
+
121
120
mrtkProfile . IsSpatialAwarenessSystemEnabled = false ;
122
-
121
+
123
122
TestUtilities . InitializeMixedRealityToolkit ( mrtkProfile ) ;
124
123
yield return PlayModeTestUtilities . WaitForInputSystemUpdate ( ) ;
125
124
@@ -129,11 +128,11 @@ public IEnumerator TestDisableSpatialAwarenessSystem()
129
128
private static MixedRealityToolkitConfigurationProfile CreateMRTKTestProfile ( string spatialAwarenessSystemPath )
130
129
{
131
130
var mrtkProfile = TestUtilities . GetDefaultMixedRealityProfile < MixedRealityToolkitConfigurationProfile > ( ) ;
132
-
131
+
133
132
mrtkProfile . SpatialAwarenessSystemSystemType = new SystemType ( typeof ( MixedRealitySpatialAwarenessSystem ) ) ;
134
133
mrtkProfile . IsSpatialAwarenessSystemEnabled = true ;
135
134
mrtkProfile . SpatialAwarenessSystemProfile = AssetDatabase . LoadAssetAtPath < MixedRealitySpatialAwarenessSystemProfile > ( spatialAwarenessSystemPath ) ;
136
-
135
+
137
136
return mrtkProfile ;
138
137
}
139
138
}
You can’t perform that action at this time.
0 commit comments