1111using UnityEngine . InputSystem . Layouts ;
1212using UnityEngine . InputSystem . LowLevel ;
1313
14+ using InputDeviceRole = UnityEngine . XR . InputDeviceRole ;
15+
1416internal class XRTests : InputTestFixture
1517{
1618 [ Test ]
1719 [ Category ( "Devices" ) ]
18- [ TestCase ( DeviceRole . Generic , "XRHMD" , typeof ( XRHMD ) ) ]
19- [ TestCase ( DeviceRole . LeftHanded , "XRController" , typeof ( XRController ) ) ]
20- [ TestCase ( DeviceRole . RightHanded , "XRController" , typeof ( XRController ) ) ]
21- [ TestCase ( DeviceRole . HardwareTracker , null , typeof ( InputDevice ) ) ]
22- [ TestCase ( DeviceRole . TrackingReference , null , typeof ( InputDevice ) ) ]
23- [ TestCase ( DeviceRole . GameController , null , typeof ( InputDevice ) ) ]
24- [ TestCase ( DeviceRole . Unknown , null , typeof ( InputDevice ) ) ]
25- public void Devices_XRDeviceRoleDeterminesTypeOfDevice ( DeviceRole role , string baseLayoutName , Type expectedType )
20+ [ TestCase ( InputDeviceRole . Generic , "XRHMD" , typeof ( XRHMD ) ) ]
21+ [ TestCase ( InputDeviceRole . LeftHanded , "XRController" , typeof ( XRController ) ) ]
22+ [ TestCase ( InputDeviceRole . RightHanded , "XRController" , typeof ( XRController ) ) ]
23+ [ TestCase ( InputDeviceRole . HardwareTracker , null , typeof ( InputDevice ) ) ]
24+ [ TestCase ( InputDeviceRole . TrackingReference , null , typeof ( InputDevice ) ) ]
25+ [ TestCase ( InputDeviceRole . GameController , null , typeof ( InputDevice ) ) ]
26+ [ TestCase ( InputDeviceRole . Unknown , null , typeof ( InputDevice ) ) ]
27+ public void Devices_XRDeviceRoleDeterminesTypeOfDevice ( InputDeviceRole role , string baseLayoutName , Type expectedType )
2628 {
2729 var deviceDescription = CreateSimpleDeviceDescriptionByRole ( role ) ;
2830 runtime . ReportNewInputDevice ( deviceDescription . ToJson ( ) ) ;
@@ -44,7 +46,7 @@ public void Devices_XRDeviceRoleDeterminesTypeOfDevice(DeviceRole role, string b
4446 [ Category ( "Devices" ) ]
4547 public void Devices_CanChangeHandednessOfXRController ( )
4648 {
47- var deviceDescription = CreateSimpleDeviceDescriptionByRole ( DeviceRole . LeftHanded ) ;
49+ var deviceDescription = CreateSimpleDeviceDescriptionByRole ( InputDeviceRole . LeftHanded ) ;
4850 runtime . ReportNewInputDevice ( deviceDescription . ToJson ( ) ) ;
4951
5052 InputSystem . Update ( ) ;
@@ -68,7 +70,7 @@ public void Devices_CanChangeHandednessOfXRController()
6870 [ Category ( "Layouts" ) ]
6971 public void Layouts_XRLayoutIsNamespacedAsInterfaceManufacturerDevice ( )
7072 {
71- var deviceDescription = CreateSimpleDeviceDescriptionByRole ( DeviceRole . Generic ) ;
73+ var deviceDescription = CreateSimpleDeviceDescriptionByRole ( InputDeviceRole . Generic ) ;
7274 runtime . ReportNewInputDevice ( deviceDescription . ToJson ( ) ) ;
7375
7476 InputSystem . Update ( ) ;
@@ -85,7 +87,7 @@ public void Layouts_XRLayoutIsNamespacedAsInterfaceManufacturerDevice()
8587 [ Category ( "Layouts" ) ]
8688 public void Layouts_XRLayoutWithoutManufacturer_IsNamespacedAsInterfaceDevice ( )
8789 {
88- var deviceDescription = CreateSimpleDeviceDescriptionByRole ( DeviceRole . Generic ) ;
90+ var deviceDescription = CreateSimpleDeviceDescriptionByRole ( InputDeviceRole . Generic ) ;
8991 deviceDescription . manufacturer = null ;
9092 runtime . ReportNewInputDevice ( deviceDescription . ToJson ( ) ) ;
9193
@@ -135,7 +137,7 @@ public void Layouts_XRLayoutFeatures_OnlyContainAllowedCharacters()
135137 [ Category ( "Layouts" ) ]
136138 public void Layouts_XRDevicesWithNoOrInvalidCapabilities_DoNotCreateLayouts ( )
137139 {
138- var deviceDescription = CreateSimpleDeviceDescriptionByRole ( DeviceRole . Generic ) ;
140+ var deviceDescription = CreateSimpleDeviceDescriptionByRole ( InputDeviceRole . Generic ) ;
139141 deviceDescription . capabilities = null ;
140142 runtime . ReportNewInputDevice ( deviceDescription . ToJson ( ) ) ;
141143
@@ -186,7 +188,7 @@ public void Layouts_XRDevicesWithNoOrInvalidCapabilities_DoNotCreateLayouts()
186188 [ TestCase ( "OpenVR Controller(Knuckles EV3.0 Left) - Left" , "Valve" , typeof ( KnucklesController ) ) ]
187189 public void Devices_KnownDevice_UsesSpecializedDeviceType ( string name , string manufacturer , Type expectedDeviceType )
188190 {
189- var deviceDescription = CreateSimpleDeviceDescriptionByRole ( DeviceRole . Generic ) ;
191+ var deviceDescription = CreateSimpleDeviceDescriptionByRole ( InputDeviceRole . Generic ) ;
190192 deviceDescription . product = name ;
191193 deviceDescription . manufacturer = manufacturer ;
192194 runtime . ReportNewInputDevice ( deviceDescription . ToJson ( ) ) ;
@@ -464,7 +466,7 @@ public void Components_CanUpdateGameObjectTransformThroughTrackedPoseDriver()
464466 }
465467 }
466468
467- private static InputDeviceDescription CreateSimpleDeviceDescriptionByRole ( DeviceRole role )
469+ private static InputDeviceDescription CreateSimpleDeviceDescriptionByRole ( InputDeviceRole role )
468470 {
469471 return new InputDeviceDescription
470472 {
@@ -474,7 +476,7 @@ private static InputDeviceDescription CreateSimpleDeviceDescriptionByRole(Device
474476 capabilities = new XRDeviceDescriptor
475477 {
476478#if ! UNITY_2019_3_OR_NEWER
477- deviceRole = role ,
479+ InputDeviceRole = role ,
478480#endif
479481 inputFeatures = new List < XRFeatureDescriptor > ( )
480482 {
0 commit comments