@@ -474,7 +474,51 @@ public IEnumerator ObjectManipulatorOneHandMoveFar()
474
474
yield return hand . Hide ( ) ;
475
475
476
476
}
477
+ }
478
+
479
+ /// <summary>
480
+ /// This tests that the cursor doesn't become focus locked when the Object Manipulator component is disabled
481
+ /// </summary>
482
+ [ UnityTest ]
483
+ public IEnumerator ObjectManipulatorNoFocusOnDisable ( )
484
+ {
485
+ // set up cube with manipulation handler
486
+ var testObject = GameObject . CreatePrimitive ( PrimitiveType . Cube ) ;
487
+ testObject . transform . localScale = Vector3 . one * 0.2f ;
488
+ Vector3 initialObjectPosition = new Vector3 ( 0f , 0f , 1f ) ;
489
+ testObject . transform . position = initialObjectPosition ;
490
+ var manipHandler = testObject . AddComponent < ObjectManipulator > ( ) ;
491
+ manipHandler . HostTransform = testObject . transform ;
492
+ manipHandler . SmoothingFar = false ;
493
+ manipHandler . SmoothingNear = false ;
494
+ manipHandler . ManipulationType = ManipulationHandFlags . OneHanded ;
495
+
496
+ // Disable the manipulation handler
497
+ manipHandler . enabled = false ;
498
+
499
+ yield return new WaitForFixedUpdate ( ) ;
500
+ yield return null ;
501
+
502
+ // Hand pointing at middle of cube
503
+ Vector3 initialHandPosition = new Vector3 ( 0.044f , - 0.1f , 0.45f ) ;
504
+ TestHand hand = new TestHand ( Handedness . Right ) ;
505
+
506
+ TestUtilities . PlayspaceToOriginLookingForward ( ) ;
507
+
508
+ yield return hand . Show ( initialHandPosition ) ;
509
+ yield return PlayModeTestUtilities . WaitForInputSystemUpdate ( ) ;
477
510
511
+ Vector3 initialPosition = testObject . transform . position ;
512
+ yield return hand . SetGesture ( ArticulatedHandPose . GestureId . Pinch ) ;
513
+ yield return PlayModeTestUtilities . WaitForInputSystemUpdate ( ) ;
514
+
515
+ Assert . IsFalse ( hand . GetPointer < ShellHandRayPointer > ( ) . IsFocusLocked ) ;
516
+
517
+ yield return hand . SetGesture ( ArticulatedHandPose . GestureId . Open ) ;
518
+ yield return PlayModeTestUtilities . WaitForInputSystemUpdate ( ) ;
519
+
520
+ Assert . IsFalse ( hand . GetPointer < ShellHandRayPointer > ( ) . IsFocusLocked ) ;
521
+ yield return hand . Hide ( ) ;
478
522
}
479
523
480
524
/// <summary>
0 commit comments