@@ -11,17 +11,9 @@ suite('oculus-go-controls', function () {
1111 component . controllers = [ ] ;
1212 // Our Mock data for enabling the controllers.
1313 component . controllersWhenPresent = [ {
14- id : 'Oculus Go Controller' ,
15- index : 0 ,
16- hand : 'right' ,
17- axes : [ 0 , 0 ] ,
18- buttons : [
19- { value : 0 , pressed : false , touched : false } ,
20- { value : 0 , pressed : false , touched : false }
21- ] ,
22- pose : { orientation : [ 1 , 0 , 0 , 0 ] , position : null }
14+ profiles : [ 'oculus-go' ] ,
15+ handedness : 'right'
2316 } ] ;
24- el . parentEl . renderer . xr . getStandingMatrix = function ( ) { } ;
2517 done ( ) ;
2618 } ;
2719 if ( el . hasLoaded ) { callback ( ) ; }
@@ -37,7 +29,7 @@ suite('oculus-go-controls', function () {
3729
3830 setup ( function ( done ) {
3931 component = this . el . components [ 'oculus-go-controls' ] ;
40- controllerSystem = this . el . sceneEl . systems [ 'tracked-controls-webvr ' ] ;
32+ controllerSystem = this . el . sceneEl . systems [ 'tracked-controls-webxr ' ] ;
4133 addEventListenersSpy = sinon . spy ( component , 'addEventListeners' ) ;
4234 injectTrackedControlsSpy = sinon . spy ( component , 'injectTrackedControls' ) ;
4335 removeEventListenersSpy = sinon . spy ( component , 'removeEventListeners' ) ;
@@ -117,14 +109,14 @@ suite('oculus-go-controls', function () {
117109 } ) ;
118110
119111 suite ( 'axismove' , function ( ) {
120- test ( 'emits trackpadmoved on axismove' , function ( done ) {
112+ test ( 'emits touchpadmoved on axismove' , function ( done ) {
121113 var el = this . el ;
122114 setupTestControllers ( el ) ;
123115
124116 // Configure the event state for which we'll use the axis state for verification.
125117 const eventState = { axis : [ 0.1 , 0.2 ] , changed : [ true , false ] } ;
126118
127- el . addEventListener ( 'trackpadmoved ' , function ( evt ) {
119+ el . addEventListener ( 'touchpadmoved ' , function ( evt ) {
128120 assert . equal ( evt . detail . x , eventState . axis [ 0 ] ) ;
129121 assert . equal ( evt . detail . y , eventState . axis [ 1 ] ) ;
130122 done ( ) ;
@@ -133,13 +125,13 @@ suite('oculus-go-controls', function () {
133125 el . emit ( 'axismove' , eventState ) ;
134126 } ) ;
135127
136- test ( 'does not emit trackpadmoved on axismove with no changes' , function ( done ) {
128+ test ( 'does not emit touchpadmoved on axismove with no changes' , function ( done ) {
137129 var el = this . el ;
138130 setupTestControllers ( el ) ;
139131
140132 // Fail purposely.
141- el . addEventListener ( 'trackpadmoved ' , function ( evt ) {
142- assert . fail ( 'trackpadmoved was called when there was no change.' ) ;
133+ el . addEventListener ( 'touchpadmoved ' , function ( evt ) {
134+ assert . fail ( 'touchpadmoved was called when there was no change.' ) ;
143135 } ) ;
144136
145137 el . emit ( 'axismove' , { axis : [ 0.1 , 0.2 ] , changed : [ false , false ] } ) ;
@@ -148,8 +140,8 @@ suite('oculus-go-controls', function () {
148140 } ) ;
149141
150142 suite ( 'buttonchanged' , function ( ) {
151- [ { button : 'trackpad ' , id : 0 } ,
152- { button : 'trigger ' , id : 1 }
143+ [ { button : 'trigger ' , id : 0 } ,
144+ { button : 'touchpad ' , id : 2 }
153145 ] . forEach ( function ( buttonDescription ) {
154146 test ( 'if we get buttonchanged for button ' + buttonDescription . id + ', emit ' + buttonDescription . button + 'changed' , function ( done ) {
155147 var el = this . el ;
@@ -190,69 +182,14 @@ suite('oculus-go-controls', function () {
190182 } ) ;
191183 } ) ;
192184
193- suite ( 'armModel' , function ( ) {
194- test ( 'does not apply armModel if armModel disabled' , function ( ) {
195- var el = this . el ;
196- el . setAttribute ( 'oculus-go-controls' , 'armModel' , false ) ;
197- setupTestControllers ( el ) ;
198-
199- var trackedControls = el . components [ 'tracked-controls-webvr' ] ;
200- var applyArmModelSpy = sinon . spy ( trackedControls , 'applyArmModel' ) ;
201- trackedControls . tick ( ) ;
202-
203- // Verify that the function which applies arm model is not called when disabled.
204- sinon . assert . notCalled ( applyArmModelSpy ) ;
205-
206- // Additionally verify that no other offsets have been applied.
207- assert . strictEqual ( el . object3D . position . x , 0 ) ;
208- assert . strictEqual ( el . object3D . position . y , 0 ) ;
209- assert . strictEqual ( el . object3D . position . z , 0 ) ;
210- } ) ;
211-
212- test ( 'applies armModel if armModel enabled' , function ( ) {
213- var el = this . el ;
214- el . setAttribute ( 'oculus-go-controls' , 'armModel' , true ) ;
215- setupTestControllers ( el ) ;
216-
217- var trackedControls = el . components [ 'tracked-controls-webvr' ] ;
218- var applyArmModelSpy = sinon . spy ( trackedControls , 'applyArmModel' ) ;
219- trackedControls . tick ( ) ;
220-
221- // Verify that the function which applies arm model is called.
222- sinon . assert . calledOnce ( applyArmModelSpy ) ;
223- } ) ;
224-
225- test ( 'verifies armModel position is applied for the right hand' , function ( ) {
226- var el = this . el ;
227- el . setAttribute ( 'oculus-go-controls' , 'armModel' , true ) ;
228- setupTestControllers ( el ) ;
229-
230- var trackedControls = el . components [ 'tracked-controls-webvr' ] ;
231- trackedControls . tick ( ) ;
232- assert . ok ( el . object3D . position . x > 0 ) ;
233- } ) ;
234-
235- test ( 'verifies armModel position is applied for the left hand' , function ( ) {
236- var el = this . el ;
237- el . setAttribute ( 'oculus-go-controls' , 'armModel' , true ) ;
238- el . setAttribute ( 'oculus-go-controls' , 'hand' , 'left' ) ;
239- el . components [ 'oculus-go-controls' ] . controllersWhenPresent [ 0 ] . hand = 'left' ;
240- setupTestControllers ( el ) ;
241-
242- var trackedControls = el . components [ 'tracked-controls-webvr' ] ;
243- trackedControls . tick ( ) ;
244- assert . ok ( el . object3D . position . x < 0 ) ;
245- } ) ;
246- } ) ;
247-
248185 /**
249186 * Establishes the baseline set of controllers needed for the tests to run.
250187 *
251188 * @param {object } el - The current entity factory.
252189 */
253190 function setupTestControllers ( el ) {
254191 var component = el . components [ 'oculus-go-controls' ] ;
255- el . sceneEl . systems [ 'tracked-controls-webvr ' ] . controllers = component . controllersWhenPresent ;
192+ el . sceneEl . systems [ 'tracked-controls-webxr ' ] . controllers = component . controllersWhenPresent ;
256193 component . checkIfControllerPresent ( ) ;
257194 }
258195} ) ;
0 commit comments