Edit

Share via


PlayModeTestUtilities Class

Definition

public ref class PlayModeTestUtilities
public class PlayModeTestUtilities
type PlayModeTestUtilities = class
Public Class PlayModeTestUtilities
Inheritance
PlayModeTestUtilities

Constructors

PlayModeTestUtilities()

Fields

UseSlowTestController

If true, the controller 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.

Properties

ControllerMoveSteps

The number of frames that elapse for each test controller movement, taking into account if slow test controller mode has been engaged.

HandMoveSteps
Obsolete.

The number of frames that elapse for each test controller movement, taking into account if slow test controller mode has been engaged.

UseSlowTestHand
Obsolete.

If true, the controller 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.

Methods

CalculateNumSteps(Int32)

Given a numSteps value, determines if the value is a 'sentinel' value of ControllerMoveStepsSentinelValue, which should be converted to the current default value of ControllerMoveSteps. If it's not the sentinel value, this returns numSteps unchanged.

EnsureInputModule()

Make sure there is a MixedRealityInputModule on the main camera, which is needed for using Unity UI with MRTK.

GenerateHandPose(ArticulatedHandPose+GestureId, Handedness, Vector3, Quaternion)
GetInputSimulationService()

Utility function to simplify code for getting access to the running InputSimulationService

GetInputSystem()
GetPointer<T>(Handedness)
HideController(Handedness, InputSimulationService)
HideHand(Handedness, InputSimulationService)
InstallTextMeshProEssentials()
MoveHand(Vector3, Vector3, ArticulatedHandPose+GestureId, Handedness, InputSimulationService, Int32)

Moves the hand from startPos to endPos.

MoveMotionController(Vector3, Vector3, SimulatedMotionControllerButtonState, Handedness, InputSimulationService, Int32)

Moves the motion controller from startPos to endPos.

PopControllerSimulationProfile()
PopHandSimulationProfile()
PushControllerSimulationProfile()
PushHandSimulationProfile()
SetControllerSimulationMode(ControllerSimulationMode)
SetHandRotation(Quaternion, Quaternion, Vector3, ArticulatedHandPose+GestureId, Handedness, Int32, InputSimulationService)
SetHandSimulationMode(ControllerSimulationMode)
SetHandState(Vector3, ArticulatedHandPose+GestureId, Handedness, InputSimulationService)
SetMotionControllerRotation(Quaternion, Quaternion, Vector3, SimulatedMotionControllerButtonState, Handedness, Int32, InputSimulationService)
SetMotionControllerState(Vector3, SimulatedMotionControllerButtonState, Handedness, InputSimulationService)
Setup(MixedRealityToolkitConfigurationProfile)

Creates a play mode test scene, creates an MRTK instance, initializes playspace.

SetupMrtkWithoutGlobalInputHandlers()

Initializes the MRTK such that there are no other input system listeners (global or per-interface).

ShowHand(Handedness, InputSimulationService, ArticulatedHandPose+GestureId, Vector3)
ShowHand(Handedness, InputSimulationService)

Shows the hand in the open state, at the origin

ShowMontionController(Handedness, InputSimulationService, SimulatedMotionControllerButtonState, Vector3)
ShowMontionController(Handedness, InputSimulationService)

Shows the motion controller in the default state, at the origin

TearDown()

Destroys all objects in the play mode test scene, if it has been loaded, and shuts down MRTK instance.

TeardownInputModule()

Destroy the input module to ensure it gets initialized cleanly for the next test.

UpdateMotionControllerPose(Handedness, Vector3, Quaternion)
WaitForEnterKey()

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.

WaitForInputSystemUpdate()

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.

Applies to