日本語翻訳ドキュメントはサポートを終了しました

MRTK 2.6 以降のドキュメントについては、公式の Microsoft ドキュメント を参照してください。

    Show / Hide Table of Contents

    Class TestUtilities

    Inheritance
    Object
    TestUtilities
    Inherited Members
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: Microsoft.MixedReality.Toolkit.Tests
    Assembly: cs.temp.dll.dll
    Syntax
    public static class TestUtilities

    Fields

    additiveTestScenes

    Declaration
    public static Scene[] additiveTestScenes
    Field Value
    Type Description
    Scene[]

    primaryTestScene

    Declaration
    public static Scene primaryTestScene
    Field Value
    Type Description
    Scene

    Properties

    ArbitraryParentPose

    Pose to create MRTK playspace's parent transform at.

    Declaration
    public static Pose ArbitraryParentPose { get; set; }
    Property Value
    Type Description
    Pose

    ArbitraryPlayspacePose

    Pose to set playspace at, when using PlayspaceToArbitraryPose().

    Declaration
    public static Pose ArbitraryPlayspacePose { get; set; }
    Property Value
    Type Description
    Pose

    Methods

    AssertAboutEqual(Quaternion, Quaternion, String, Single)

    Declaration
    public static void AssertAboutEqual(Quaternion actual, Quaternion expected, string message, float tolerance = 0.01F)
    Parameters
    Type Name Description
    Quaternion actual
    Quaternion expected
    String message
    Single tolerance

    AssertAboutEqual(Vector3, Vector3, String, Single)

    Declaration
    public static void AssertAboutEqual(Vector3 actual, Vector3 expected, string message, float tolerance = 0.01F)
    Parameters
    Type Name Description
    Vector3 actual
    Vector3 expected
    String message
    Single tolerance

    AssertGreaterOrEqual(Single, Single, Single)

    Equvalent to NUnit.Framework.Assert.GreaterOrEqual, except this also applies a slight tolerance on the equality check.

    Declaration
    public static void AssertGreaterOrEqual(float observed, float expected, float tolerance = 0.01F)
    Parameters
    Type Name Description
    Single observed
    Single expected
    Single tolerance
    Remarks

    This allows for things like GreaterThanOrEqual(1.999999999, 2.0) to still pass.

    AssertGreaterOrEqual(Single, Single, String, Single)

    Equvalent to NUnit.Framework.Assert.GreaterOrEqual, except this also applies a slight tolerance on the equality check.

    Declaration
    public static void AssertGreaterOrEqual(float observed, float expected, string message, float tolerance = 0.01F)
    Parameters
    Type Name Description
    Single observed
    Single expected
    String message
    Single tolerance
    Remarks

    This allows for things like GreaterThanOrEqual(1.999999999, 2.0) to still pass.

    AssertLessOrEqual(Single, Single, Single)

    Equvalent to NUnit.Framework.Assert.LessOrEqual, except this also applies a slight tolerance on the equality check.

    Declaration
    public static void AssertLessOrEqual(float observed, float expected, float tolerance = 0.01F)
    Parameters
    Type Name Description
    Single observed
    Single expected
    Single tolerance
    Remarks

    This allows for things like LessThanOrEqual(2.00000024, 2.0) to still pass.

    AssertLessOrEqual(Single, Single, String, Single)

    Equvalent to NUnit.Framework.Assert.LessOrEqual, except this also applies a slight tolerance on the equality check.

    Declaration
    public static void AssertLessOrEqual(float observed, float expected, string message, float tolerance = 0.01F)
    Parameters
    Type Name Description
    Single observed
    Single expected
    String message
    Single tolerance
    Remarks

    This allows for things like LessThanOrEqual(2.00000024, 2.0) to still pass.

    AssertNotAboutEqual(Quaternion, Quaternion, String, Single)

    Declaration
    public static void AssertNotAboutEqual(Quaternion val1, Quaternion val2, string message, float tolerance = 0.01F)
    Parameters
    Type Name Description
    Quaternion val1
    Quaternion val2
    String message
    Single tolerance

    AssertNotAboutEqual(Vector3, Vector3, String, Single)

    Declaration
    public static void AssertNotAboutEqual(Vector3 val1, Vector3 val2, string message, float tolerance = 0.01F)
    Parameters
    Type Name Description
    Vector3 val1
    Vector3 val2
    String message
    Single tolerance

    DirectionRelativeToPlayspace(Vector3)

    Compute the world direction corresponding to the input local direction in playspace.

    Declaration
    public static Vector3 DirectionRelativeToPlayspace(Vector3 localDirection)
    Parameters
    Type Name Description
    Vector3 localDirection

    The local direction.

    Returns
    Type Description
    Vector3

    The world direction.

    EditorCreateScenes(Int32)

    Creates a number of scenes and loads them additively for testing. Must create a minimum of 1. Used only in editor tests.

    Declaration
    public static void EditorCreateScenes(int numScenesToCreate = 1)
    Parameters
    Type Name Description
    Int32 numScenesToCreate

    EditorTearDownScenes()

    Destroys all scene assets that were created over the course of testing. Used only in editor tests.

    Declaration
    public static void EditorTearDownScenes()

    GetDefaultMixedRealityProfile<T>()

    Declaration
    public static T GetDefaultMixedRealityProfile<T>()
        where T : BaseMixedRealityProfile
    Returns
    Type Description
    T
    Type Parameters
    Name Description
    T

    InitializeCamera()

    Declaration
    public static void InitializeCamera()

    InitializeMixedRealityToolkit(MixedRealityToolkitConfigurationProfile)

    Declaration
    public static void InitializeMixedRealityToolkit(MixedRealityToolkitConfigurationProfile configuration)
    Parameters
    Type Name Description
    MixedRealityToolkitConfigurationProfile configuration

    InitializeMixedRealityToolkit(Boolean)

    Declaration
    public static void InitializeMixedRealityToolkit(bool useDefaultProfile = false)
    Parameters
    Type Name Description
    Boolean useDefaultProfile

    InitializeMixedRealityToolkitAndCreateScenes(Boolean, Int32)

    Creates the requested number of scenes, then creates one instance of the MixedRealityToolkit in the active scene.

    Declaration
    public static void InitializeMixedRealityToolkitAndCreateScenes(bool useDefaultProfile = false, int numScenesToCreate = 1)
    Parameters
    Type Name Description
    Boolean useDefaultProfile
    Int32 numScenesToCreate

    InitializePlayspace()

    Creates a playspace and moves it into a default position.

    Declaration
    public static void InitializePlayspace()

    PlaceRelativeToPlayspace(Transform)

    Place the transform in world space as if its current world pose were its local pose and it was attached to the playspace.

    Declaration
    public static void PlaceRelativeToPlayspace(Transform transform)
    Parameters
    Type Name Description
    Transform transform

    The transform to place.

    Remarks

    If the transform has no parent, then this is equivalent to the following sequence:

    1. transform.SetParent(MixedRealityPlayspace.Transform, false);
    2. transform.SetParent(null, true); However, if the transform has a parent, then the transform's world transform, not just its local transform, will determine its final pose relative to the playspace.

    PlaceRelativeToPlayspace(Transform, Vector3, Quaternion)

    Place the transform in world space as if it had the input local pose and was attached to the playspace.

    Declaration
    public static void PlaceRelativeToPlayspace(Transform transform, Vector3 localPosition, Quaternion localRotation)
    Parameters
    Type Name Description
    Transform transform

    The transform to place.

    Vector3 localPosition

    The local position in playspace.

    Quaternion localRotation

    The local rotation in playspace.

    Remarks

    Note that the transform's current local and world poses are ignored and overwritten.

    PlaceRelativeToPlayspace(Vector3, Quaternion)

    Return a pose equivalent to the input local pose appended to the current playspace pose.

    Declaration
    public static Pose PlaceRelativeToPlayspace(Vector3 localPosition, Quaternion localRotation)
    Parameters
    Type Name Description
    Vector3 localPosition

    Position relative to playspace.

    Quaternion localRotation

    Orientation relative to playspace.

    Returns
    Type Description
    Pose

    Equivalent pose.

    Remarks

    This computes the world pose an object with the input local pose would have if it were a child of the playspace.

    PlayspaceToArbitraryPose()

    Set the playspace to an arbitrary (but known) non-identity pose.

    Declaration
    public static void PlayspaceToArbitraryPose()
    Remarks

    When using this arbitrary pose imposed on the playspace to better validate compliance with real world scenarios, it can be convenient to use the *RelativeToPlayspace() helpers below. For example, to place an object directly 8 meters in front of the camera, set its position to TestUtilities.PositionRelativeToPlayspace(0.0f, 0.0f, 8.0f). See also PlaceRelativeToPlayspace(Transform) to convert an object's local transform into a transform relative to the playspace.

    PlayspaceToOriginLookingForward()

    Forces the playspace camera to origin facing forward along +Z.

    Declaration
    public static void PlayspaceToOriginLookingForward()

    PlayspaceToPositionAndRotation(Vector3, Quaternion)

    Force the playspace camera into the specified position and orientation.

    Declaration
    public static void PlayspaceToPositionAndRotation(Vector3 position, Quaternion rotation)
    Parameters
    Type Name Description
    Vector3 position

    World space position for the playspace.

    Quaternion rotation

    World space orientation for the playspace.

    Remarks

    Note that this has no effect on the camera's local space transform, but will change the camera's world space position. If and only if the camera's local transform is identity with the camera's world transform equal the playspace's.

    PositionRelativeToPlayspace(Vector3)

    Compute the world position corresponding to the input local position in playspace.

    Declaration
    public static Vector3 PositionRelativeToPlayspace(Vector3 localPosition)
    Parameters
    Type Name Description
    Vector3 localPosition

    The local position.

    Returns
    Type Description
    Vector3

    The world position.

    RotationRelativeToPlayspace(Quaternion)

    Compute the world rotation corresponding to the input local rotation in playspace.

    Declaration
    public static Quaternion RotationRelativeToPlayspace(Quaternion localRotation)
    Parameters
    Type Name Description
    Quaternion localRotation

    The rotation in local space.

    Returns
    Type Description
    Quaternion

    The rotation in world space.

    ShutdownMixedRealityToolkit()

    Declaration
    public static void ShutdownMixedRealityToolkit()
    Back to top Generated by DocFX