Class TestButtonUtilities
Utility class that provides helpful methods for generating and assembling buttons to be used in tests Also provides functions to test/simulate pressing buttons etc
Inherited Members
Namespace: Microsoft.MixedReality.Toolkit.Tests
Assembly: cs.temp.dll.dll
Syntax
public static class TestButtonUtilities
Fields
ButtonPressAnimationDelay
Rought amount of time for press action on button
Declaration
public const float ButtonPressAnimationDelay = 0.25F
Field Value
| Type | Description |
|---|---|
| Single |
ButtonReleaseAnimationDelay
Rought amount of time for release action on button
Declaration
public const float ButtonReleaseAnimationDelay = 0.25F
Field Value
| Type | Description |
|---|---|
| Single |
DefaultInteractablePrefabAssetPath
Asset Path to default model push button prefab asset
Declaration
public const string DefaultInteractablePrefabAssetPath = "Assets/MixedRealityToolkit.Examples/Demos/UX/Interactables/Prefabs/Model_PushButton.prefab"
Field Value
| Type | Description |
|---|---|
| String |
DefaultPosition
Default position of new interactable buttons instantiated
Declaration
public static readonly Vector3 DefaultPosition
Field Value
| Type | Description |
|---|---|
| Vector3 |
DefaultRotation
Default rotation applied to new interactable button instantiated
Declaration
public static readonly Quaternion DefaultRotation
Field Value
| Type | Description |
|---|---|
| Quaternion |
PressableHoloLens2PrefabPath
Asset path to default Hololens 2 Pressable Button prefab asset
Declaration
public const string PressableHoloLens2PrefabPath = "Assets/MixedRealityToolkit.SDK/Features/UX/Interactable/Prefabs/PressableButtonHoloLens2.prefab"
Field Value
| Type | Description |
|---|---|
| String |
PressableHoloLens2TogglePrefabPath
Asset path to default Hololens 2 Toggle Pressable Button prefab asset
Declaration
public const string PressableHoloLens2TogglePrefabPath = "Assets/MixedRealityToolkit.SDK/Features/UX/Interactable/Prefabs/PressableButtonHoloLens2Toggle.prefab"
Field Value
| Type | Description |
|---|---|
| String |
Methods
CheckButtonTranslation(Vector3, Transform, Boolean)
Confirms that provided Transform translates as expected due to a press currently happening
Declaration
public static IEnumerator CheckButtonTranslation(Vector3 targetStartPosition, Transform translateTarget, bool shouldTranslate = true)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | targetStartPosition | |
| Transform | translateTarget | |
| Boolean | shouldTranslate |
Returns
| Type | Description |
|---|---|
| IEnumerator |
InstantiateDefaultButton(TestButtonUtilities.DefaultButtonType, out Interactable, out Transform)
Instantiate and configure one of the TestButtonUtilities.DefaultButtonType types. Returns reference to Interactable component and Transform to movable object that transforms on press
Declaration
public static void InstantiateDefaultButton(TestButtonUtilities.DefaultButtonType buttonType, out Interactable interactable, out Transform translateTargetObject)
Parameters
| Type | Name | Description |
|---|---|---|
| TestButtonUtilities.DefaultButtonType | buttonType | |
| Interactable | interactable | |
| Transform | translateTargetObject |
InstantiateInteractableFromPath(Vector3, Quaternion, String)
Instantiates Interactable prefab from provided asset database path at given position and rotation
Declaration
public static GameObject InstantiateInteractableFromPath(Vector3 position, Quaternion rotation, string path)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | position | |
| Quaternion | rotation | |
| String | path |
Returns
| Type | Description |
|---|---|
| GameObject |
InstantiatePressableButtonPrefab(Vector3, Quaternion, String, String, out Interactable, out Transform)
Instantiates Pressable Button based on list of arguments provided
Declaration
public static void InstantiatePressableButtonPrefab(Vector3 position, Quaternion rotation, string prefabPath, string translateTargetPath, out Interactable interactable, out Transform translateTargetTransform)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | position | |
| Quaternion | rotation | |
| String | prefabPath | |
| String | translateTargetPath | |
| Interactable | interactable | |
| Transform | translateTargetTransform |
MoveHandAwayFromButton(Transform)
Move the right from in the button to just in front of the button
Declaration
public static IEnumerator MoveHandAwayFromButton(Transform button)
Parameters
| Type | Name | Description |
|---|---|---|
| Transform | button |
Returns
| Type | Description |
|---|---|
| IEnumerator |
MoveHandToButton(Transform)
Move the right hand from in front of the button through to the button
Declaration
public static IEnumerator MoveHandToButton(Transform button)
Parameters
| Type | Name | Description |
|---|---|---|
| Transform | button |
Returns
| Type | Description |
|---|---|
| IEnumerator |
TestClickPushButton(Transform, Vector3, Transform, Boolean)
Execute and test end-to-end press of a button with right hand poke pointer
Declaration
public static IEnumerator TestClickPushButton(Transform button, Vector3 targetStartPosition, Transform translateTargetObject, bool shouldClick = true)
Parameters
| Type | Name | Description |
|---|---|---|
| Transform | button | Position of button to push hand to/through |
| Vector3 | targetStartPosition | The start position of the button component that will translate on press |
| Transform | translateTargetObject | Transform of the button component that will translate on press |
| Boolean | shouldClick | Should we expect a click (i.e translation) from the button. The button may be disabled |
Returns
| Type | Description |
|---|---|
| IEnumerator |