docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class RuntimeUITestFixture

    Test fixture base class that creates a Runtime panel.

    Inheritance
    object
    AbstractUITestFixture
    CommonUITestFixture
    RuntimeUITestFixture
    Inherited Members
    CommonUITestFixture.AddTestComponent(UITestComponent)
    CommonUITestFixture.RemoveTestComponent(UITestComponent)
    CommonUITestFixture.FindTestComponent<T>()
    CommonUITestFixture.simulate
    CommonUITestFixture.clearContentAfterTest
    CommonUITestFixture.themeStyleSheet
    AbstractUITestFixture.AddTestComponent<T>()
    AbstractUITestFixture.RemoveTestComponent<T>()
    AbstractUITestFixture.panel
    AbstractUITestFixture.rootVisualElement
    AbstractUITestFixture.panelName
    AbstractUITestFixture.needsRendering
    AbstractUITestFixture.pixelsPerPoint
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: UnityEngine.UIElements.TestFramework
    Assembly: Unity.UI.TestFramework.Runtime.dll
    Syntax
    public abstract class RuntimeUITestFixture : CommonUITestFixture
    Remarks

    Use this class when you want to write PlayMode tests for UI Toolkit content. By default, the Runtime panel created will use the Default runtime theme. To customize the runtime theme used during tests, see themeStyleSheet. By default, the test class creates an empty Runtime panel with no UIDocument attached. To set your own UI content to use during the test, use SetUIContent(UIDocument).

    Constructors

    RuntimeUITestFixture()

    Instantiates a new empty RuntimeUITestFixture.

    Declaration
    protected RuntimeUITestFixture()

    Properties

    panelSize

    The size of the root VisualElement of the panel.

    Declaration
    public override sealed Vector2 panelSize { get; set; }
    Property Value
    Type Description
    Vector2
    Overrides
    AbstractUITestFixture.panelSize

    Methods

    ApplyPanelSize()

    Apply the panelSize to the panel.

    Declaration
    public void ApplyPanelSize()

    CreateDefaultUIScene()

    Sets up a GameObject with an empty UIDocument. Use themeStyleSheet to set the stylesheet. To use your own UI content during the test, use SetUIContent(UIDocument).

    Declaration
    public void CreateDefaultUIScene()

    FixtureOneTimeSetUp()

    Sets up the test fixture.

    Declaration
    public override void FixtureOneTimeSetUp()
    Overrides
    CommonUITestFixture.FixtureOneTimeSetUp()

    FixtureOneTimeTearDown()

    Tears down the test fixture.

    Declaration
    public override void FixtureOneTimeTearDown()
    Overrides
    CommonUITestFixture.FixtureOneTimeTearDown()

    FixtureSetUp()

    Sets up the test.

    Declaration
    public override void FixtureSetUp()
    Overrides
    CommonUITestFixture.FixtureSetUp()

    FixtureTearDown()

    Tears down the test.

    Declaration
    public override void FixtureTearDown()
    Overrides
    CommonUITestFixture.FixtureTearDown()

    RecreatePanel()

    Recreates the simulated UIToolkit panel, providing a fresh instance. If a custom UIDocument was set using SetUIContent(UIDocument), the associated GameObject will be disabled and re-enabled instead of recreated.

    Declaration
    public override void RecreatePanel()
    Overrides
    AbstractUITestFixture.RecreatePanel()

    ReleasePanel()

    Destroys created scene components. Destroys the UIDocument.

    Declaration
    public override void ReleasePanel()
    Overrides
    AbstractUITestFixture.ReleasePanel()

    SetUIContent(UIDocument)

    Assigns the specified UIDocument to be used by the test fixture.

    Declaration
    public void SetUIContent(UIDocument doc)
    Parameters
    Type Name Description
    UIDocument doc

    The UIDocument component to host the test content.

    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)