Class PlayModeTestUtilities
Inheritance
PlayModeTestUtilities
Assembly: cs.temp.dll.dll
public class PlayModeTestUtilities
Fields
If true, the hand movement test steps will take a longer number of frames. This is especially
useful for seeing motion in play mode tests (where the default smaller number of frames tends
to make tests too fast to be understandable to the human eye). This is false by default
to ensure that tests will run quickly in general, and can be set to true manually in specific
test cases using the example below.
Declaration
public static bool UseSlowTestHand
Field Value
[UnityTest]
public IEnumerator YourTestCase()
{
PlayModeTestUtilities.UseSlowTestHand = true;
...
PlayModeTestUtilities.UseSlowTestHand = false;
}
Properties
The number of frames that elapse for each test hand movement, taking into account if
slow test hand mode has been engaged.
Declaration
public static int HandMoveSteps { get; }
Property Value
Methods
Given a numSteps value, determines if the value is a 'sentinel' value of
HandMoveStepsSentinelValue, which should be converted to the current
default value of HandMoveSteps. If it's not the sentinel value,
this returns numSteps unchanged.
Declaration
public static int CalculateNumSteps(int numSteps)
Parameters
Type |
Name |
Description |
Int32 |
numSteps |
|
Returns
Make sure there is a MixedRealityInputModule on the main camera, which is needed for using Unity UI with MRTK.
Declaration
public static void EnsureInputModule()
Declaration
public static SimulatedHandData.HandJointDataGenerator GenerateHandPose(ArticulatedHandPose.GestureId gesture, Handedness handedness, Vector3 worldPosition, Quaternion rotation)
Parameters
Type |
Name |
Description |
ArticulatedHandPose.GestureId |
gesture |
|
Handedness |
handedness |
|
Vector3 |
worldPosition |
|
Quaternion |
rotation |
|
Returns
Type |
Description |
SimulatedHandData.HandJointDataGenerator |
|
Utility function to simplify code for getting access to the running InputSimulationService
Declaration
public static InputSimulationService GetInputSimulationService()
Returns
Type |
Description |
InputSimulationService |
Returns InputSimulationService registered for playmode test scene
|
Declaration
public static IMixedRealityInputSystem GetInputSystem()
Returns
Type |
Description |
IMixedRealityInputSystem |
|
Declaration
public static T GetPointer<T>(Handedness handedness)
where T : class, IMixedRealityPointer
Parameters
Type |
Name |
Description |
Handedness |
handedness |
|
Returns
Type Parameters
Declaration
public static IEnumerator HideHand(Handedness handedness, InputSimulationService inputSimulationService)
Parameters
Type |
Name |
Description |
Handedness |
handedness |
|
InputSimulationService |
inputSimulationService |
|
Returns
Type |
Description |
IEnumerator |
|
InstallTextMeshProEssentials()
Declaration
public static void InstallTextMeshProEssentials()
Moves the hand from startPos to endPos.
Declaration
public static IEnumerator MoveHand(Vector3 startPos, Vector3 endPos, ArticulatedHandPose.GestureId gestureId, Handedness handedness, InputSimulationService inputSimulationService, int numSteps = -1)
Parameters
Type |
Name |
Description |
Vector3 |
startPos |
|
Vector3 |
endPos |
|
ArticulatedHandPose.GestureId |
gestureId |
|
Handedness |
handedness |
|
InputSimulationService |
inputSimulationService |
|
Int32 |
numSteps |
|
Returns
Type |
Description |
IEnumerator |
|
Declaration
public static void PopHandSimulationProfile()
Declaration
public static void PushHandSimulationProfile()
Declaration
public static IEnumerator SetHandRotation(Quaternion fromRotation, Quaternion toRotation, Vector3 handPos, ArticulatedHandPose.GestureId gestureId, Handedness handedness, int numSteps, InputSimulationService inputSimulationService)
Parameters
Type |
Name |
Description |
Quaternion |
fromRotation |
|
Quaternion |
toRotation |
|
Vector3 |
handPos |
|
ArticulatedHandPose.GestureId |
gestureId |
|
Handedness |
handedness |
|
Int32 |
numSteps |
|
InputSimulationService |
inputSimulationService |
|
Returns
Type |
Description |
IEnumerator |
|
Declaration
public static void SetHandSimulationMode(HandSimulationMode mode)
Parameters
Type |
Name |
Description |
HandSimulationMode |
mode |
|
Declaration
public static IEnumerator SetHandState(Vector3 handPos, ArticulatedHandPose.GestureId gestureId, Handedness handedness, InputSimulationService inputSimulationService)
Parameters
Type |
Name |
Description |
Vector3 |
handPos |
|
ArticulatedHandPose.GestureId |
gestureId |
|
Handedness |
handedness |
|
InputSimulationService |
inputSimulationService |
|
Returns
Type |
Description |
IEnumerator |
|
Creates a play mode test scene, creates an MRTK instance, initializes playspace.
Declaration
public static void Setup()
Initializes the MRTK such that there are no other input system listeners
(global or per-interface).
Declaration
public static IEnumerator SetupMrtkWithoutGlobalInputHandlers()
Returns
Type |
Description |
IEnumerator |
|
Shows the hand in the open state, at the origin
Declaration
public static IEnumerator ShowHand(Handedness handedness, InputSimulationService inputSimulationService)
Parameters
Type |
Name |
Description |
Handedness |
handedness |
|
InputSimulationService |
inputSimulationService |
|
Returns
Type |
Description |
IEnumerator |
|
Declaration
public static IEnumerator ShowHand(Handedness handedness, InputSimulationService inputSimulationService, ArticulatedHandPose.GestureId handPose, Vector3 handLocation)
Parameters
Type |
Name |
Description |
Handedness |
handedness |
|
InputSimulationService |
inputSimulationService |
|
ArticulatedHandPose.GestureId |
handPose |
|
Vector3 |
handLocation |
|
Returns
Type |
Description |
IEnumerator |
|
Destroys all objects in the play mode test scene, if it has been loaded, and shuts down MRTK instance.
Declaration
public static void TearDown()
Destroy the input module to ensure it gets initialized cleanly for the next test.
Declaration
public static void TeardownInputModule()
Waits for the user to press the enter key before a test continues.
Not actually used by any test, but it is useful when debugging since you can
pause the state of the test and inspect the scene.
Declaration
public static IEnumerator WaitForEnterKey()
Returns
Type |
Description |
IEnumerator |
|
Sometimes it take a few frames for inputs raised via InputSystem.OnInput*
to actually get sent to input handlers. This method waits for enough frames
to pass so that any events raised actually have time to send to handlers.
We set it fairly conservatively to ensure that after waiting
all input events have been sent.
Declaration
public static IEnumerator WaitForInputSystemUpdate()
Returns
Type |
Description |
IEnumerator |
|