1010using UnityEngine . InputSystem . Controls ;
1111using UnityEngine . InputSystem . Layouts ;
1212using UnityEngine . InputSystem . LowLevel ;
13+ using UnityEngine . XR ;
14+
15+ using Usages = UnityEngine . InputSystem . CommonUsages ;
1316
1417internal class XRTests : InputTestFixture
1518{
1619 [ Test ]
1720 [ 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 )
21+ [ TestCase ( InputDeviceRole . Generic , "XRHMD" , typeof ( XRHMD ) ) ]
22+ [ TestCase ( InputDeviceRole . LeftHanded , "XRController" , typeof ( XRController ) ) ]
23+ [ TestCase ( InputDeviceRole . RightHanded , "XRController" , typeof ( XRController ) ) ]
24+ [ TestCase ( InputDeviceRole . HardwareTracker , null , typeof ( UnityEngine . InputSystem . InputDevice ) ) ]
25+ [ TestCase ( InputDeviceRole . TrackingReference , null , typeof ( UnityEngine . InputSystem . InputDevice ) ) ]
26+ [ TestCase ( InputDeviceRole . GameController , null , typeof ( UnityEngine . InputSystem . InputDevice ) ) ]
27+ [ TestCase ( InputDeviceRole . Unknown , null , typeof ( UnityEngine . InputSystem . InputDevice ) ) ]
28+ public void Devices_XRDeviceRoleDeterminesTypeOfDevice ( InputDeviceRole role , string baseLayoutName , Type expectedType )
2629 {
2730 var deviceDescription = CreateSimpleDeviceDescriptionByRole ( role ) ;
2831 runtime . ReportNewInputDevice ( deviceDescription . ToJson ( ) ) ;
@@ -44,22 +47,22 @@ public void Devices_XRDeviceRoleDeterminesTypeOfDevice(DeviceRole role, string b
4447 [ Category ( "Devices" ) ]
4548 public void Devices_CanChangeHandednessOfXRController ( )
4649 {
47- var deviceDescription = CreateSimpleDeviceDescriptionByRole ( DeviceRole . LeftHanded ) ;
50+ var deviceDescription = CreateSimpleDeviceDescriptionByRole ( InputDeviceRole . LeftHanded ) ;
4851 runtime . ReportNewInputDevice ( deviceDescription . ToJson ( ) ) ;
4952
5053 InputSystem . Update ( ) ;
5154
5255 var controller = InputSystem . devices [ 0 ] ;
5356
54- Assert . That ( controller . usages , Has . Exactly ( 1 ) . EqualTo ( CommonUsages . LeftHand ) ) ;
55- Assert . That ( controller . usages , Has . Exactly ( 0 ) . EqualTo ( CommonUsages . RightHand ) ) ;
57+ Assert . That ( controller . usages , Has . Exactly ( 1 ) . EqualTo ( Usages . LeftHand ) ) ;
58+ Assert . That ( controller . usages , Has . Exactly ( 0 ) . EqualTo ( Usages . RightHand ) ) ;
5659 Assert . That ( XRController . rightHand , Is . Null ) ;
5760 Assert . That ( XRController . leftHand , Is . EqualTo ( controller ) ) ;
5861
59- InputSystem . SetDeviceUsage ( controller , CommonUsages . RightHand ) ;
62+ InputSystem . SetDeviceUsage ( controller , Usages . RightHand ) ;
6063
61- Assert . That ( controller . usages , Has . Exactly ( 0 ) . EqualTo ( CommonUsages . LeftHand ) ) ;
62- Assert . That ( controller . usages , Has . Exactly ( 1 ) . EqualTo ( CommonUsages . RightHand ) ) ;
64+ Assert . That ( controller . usages , Has . Exactly ( 0 ) . EqualTo ( Usages . LeftHand ) ) ;
65+ Assert . That ( controller . usages , Has . Exactly ( 1 ) . EqualTo ( Usages . RightHand ) ) ;
6366 Assert . That ( XRController . rightHand , Is . EqualTo ( controller ) ) ;
6467 Assert . That ( XRController . leftHand , Is . Null ) ;
6568 }
@@ -68,7 +71,7 @@ public void Devices_CanChangeHandednessOfXRController()
6871 [ Category ( "Layouts" ) ]
6972 public void Layouts_XRLayoutIsNamespacedAsInterfaceManufacturerDevice ( )
7073 {
71- var deviceDescription = CreateSimpleDeviceDescriptionByRole ( DeviceRole . Generic ) ;
74+ var deviceDescription = CreateSimpleDeviceDescriptionByRole ( InputDeviceRole . Generic ) ;
7275 runtime . ReportNewInputDevice ( deviceDescription . ToJson ( ) ) ;
7376
7477 InputSystem . Update ( ) ;
@@ -85,7 +88,7 @@ public void Layouts_XRLayoutIsNamespacedAsInterfaceManufacturerDevice()
8588 [ Category ( "Layouts" ) ]
8689 public void Layouts_XRLayoutWithoutManufacturer_IsNamespacedAsInterfaceDevice ( )
8790 {
88- var deviceDescription = CreateSimpleDeviceDescriptionByRole ( DeviceRole . Generic ) ;
91+ var deviceDescription = CreateSimpleDeviceDescriptionByRole ( InputDeviceRole . Generic ) ;
8992 deviceDescription . manufacturer = null ;
9093 runtime . ReportNewInputDevice ( deviceDescription . ToJson ( ) ) ;
9194
@@ -135,7 +138,7 @@ public void Layouts_XRLayoutFeatures_OnlyContainAllowedCharacters()
135138 [ Category ( "Layouts" ) ]
136139 public void Layouts_XRDevicesWithNoOrInvalidCapabilities_DoNotCreateLayouts ( )
137140 {
138- var deviceDescription = CreateSimpleDeviceDescriptionByRole ( DeviceRole . Generic ) ;
141+ var deviceDescription = CreateSimpleDeviceDescriptionByRole ( InputDeviceRole . Generic ) ;
139142 deviceDescription . capabilities = null ;
140143 runtime . ReportNewInputDevice ( deviceDescription . ToJson ( ) ) ;
141144
@@ -186,7 +189,7 @@ public void Layouts_XRDevicesWithNoOrInvalidCapabilities_DoNotCreateLayouts()
186189 [ TestCase ( "OpenVR Controller(Knuckles EV3.0 Left) - Left" , "Valve" , typeof ( KnucklesController ) ) ]
187190 public void Devices_KnownDevice_UsesSpecializedDeviceType ( string name , string manufacturer , Type expectedDeviceType )
188191 {
189- var deviceDescription = CreateSimpleDeviceDescriptionByRole ( DeviceRole . Generic ) ;
192+ var deviceDescription = CreateSimpleDeviceDescriptionByRole ( InputDeviceRole . Generic ) ;
190193 deviceDescription . product = name ;
191194 deviceDescription . manufacturer = manufacturer ;
192195 runtime . ReportNewInputDevice ( deviceDescription . ToJson ( ) ) ;
@@ -362,7 +365,7 @@ public void Layouts_ButtonsArePackedByTheByte_WhileLargerStructuresAreFourByteAl
362365 }
363366
364367 [ InputControlLayout ( updateBeforeRender = true ) ]
365- private class TestHMD : InputDevice
368+ private class TestHMD : UnityEngine . InputSystem . InputDevice
366369 {
367370 [ InputControl ]
368371 public QuaternionControl quaternion { get ; private set ; }
@@ -464,7 +467,7 @@ public void Components_CanUpdateGameObjectTransformThroughTrackedPoseDriver()
464467 }
465468 }
466469
467- private static InputDeviceDescription CreateSimpleDeviceDescriptionByRole ( DeviceRole role )
470+ private static InputDeviceDescription CreateSimpleDeviceDescriptionByRole ( InputDeviceRole role )
468471 {
469472 return new InputDeviceDescription
470473 {
@@ -498,7 +501,7 @@ private static InputDeviceDescription CreateMangledNameDeviceDescription()
498501 capabilities = new XRDeviceDescriptor
499502 {
500503#if ! UNITY_2019_3_OR_NEWER
501- deviceRole = DeviceRole . Generic ,
504+ deviceRole = InputDeviceRole . Generic ,
502505#endif
503506
504507 inputFeatures = new List < XRFeatureDescriptor > ( )
@@ -535,7 +538,7 @@ public static InputDeviceDescription CreateDeviceDescription()
535538 capabilities = new XRDeviceDescriptor
536539 {
537540#if ! UNITY_2019_3_OR_NEWER
538- deviceRole = DeviceRole . Generic ,
541+ deviceRole = InputDeviceRole . Generic ,
539542#endif
540543 inputFeatures = new List < XRFeatureDescriptor > ( )
541544 {
@@ -612,7 +615,7 @@ public static InputDeviceDescription CreateDeviceDescription()
612615 capabilities = new XRDeviceDescriptor
613616 {
614617#if ! UNITY_2019_3_OR_NEWER
615- deviceRole = DeviceRole . Generic ,
618+ deviceRole = InputDeviceRole . Generic ,
616619#endif
617620 inputFeatures = new List < XRFeatureDescriptor > ( )
618621 {
0 commit comments