docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class EditorWindowUITestFixture<EditorWindowType>

    Test fixture base class that creates an EditorWindow.

    Inheritance
    object
    AbstractUITestFixture
    CommonUITestFixture
    EditorWindowUITestFixture<EditorWindowType>
    Inherited Members
    CommonUITestFixture.AddTestComponent(UITestComponent)
    CommonUITestFixture.RemoveTestComponent(UITestComponent)
    CommonUITestFixture.FindTestComponent<T>()
    CommonUITestFixture.simulate
    CommonUITestFixture.clearContentAfterTest
    CommonUITestFixture.themeStyleSheet
    CommonUITestFixture.debugMode
    CommonUITestFixture.FixtureUnitySetUp()
    CommonUITestFixture.FixtureUnityTearDown()
    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: UnityEditor.UIElements.TestFramework
    Assembly: Unity.UI.TestFramework.Editor.dll
    Syntax
    public abstract class EditorWindowUITestFixture<EditorWindowType> : CommonUITestFixture where EditorWindowType : EditorWindow
    Type Parameters
    Name Description
    EditorWindowType

    The type of EditorWindow to create with this test fixture.

    Remarks

    Inherit from this class when your UI is defined in the CreateGUI method, or when your window contains IMGUI content that requires a GUIView context. If you don't require an actual EditorWindow and an Editor panel is sufficient, use UITestFixture instead.

    Constructors

    EditorWindowUITestFixture()

    Instantiates an empty EditorWindowUITestFixture.

    Declaration
    protected EditorWindowUITestFixture()
    Remarks

    Use the simulate property to access the UI Toolkit panel. Use the window property to access the window.

    Properties

    createWindowFunction

    Creates a new window.

    Declaration
    public Func<EditorWindowType> createWindowFunction { get; set; }
    Property Value
    Type Description
    Func<EditorWindowType>
    Remarks

    If not set, the EditorWindow instance is created using CreateInstance(Type). Use it to designate an alternate window creation function. Called when the test fixture starts or the window is null at test start.

    needsImprovedIMGUISupport

    Whether to call FrameUpdate(double) within an IMGUI context. Defaults to false.

    Declaration
    public bool needsImprovedIMGUISupport { get; set; }
    Property Value
    Type Description
    bool

    panelSize

    The size of the rootVisualElement of the panel.

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

    releaseWindowFunction

    Releases the window.

    Declaration
    public Action<EditorWindowType> releaseWindowFunction { get; set; }
    Property Value
    Type Description
    Action<EditorWindowType>
    Remarks

    By default, if this function is not set, the EditorWindow instance is Closed() and destroyed. Use this function to designate an alternate window release function. This function is called at the end of the test fixture, or at the end of a test if it has failed.

    window

    EditorWindow created by the test fixture. Null if no window is created.

    Declaration
    protected EditorWindowType window { get; }
    Property Value
    Type Description
    EditorWindowType
    Remarks

    The window is reused for the entire duration of the test fixture except if a test fails. In that case, the next test creates a new window.

    Methods

    ExecuteWithinIMGUIContext(Action)

    Executes the given command within a valid IMGUI context.

    Declaration
    protected void ExecuteWithinIMGUIContext(Action command)
    Parameters
    Type Name Description
    Action command

    The Action to be executed.

    FixtureOneTimeSetUp()

    Sets up the test fixture. Creates and sets up the window.

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

    FixtureOneTimeTearDown()

    Tears down the test fixture. When a test fails and debugMode is set to true, windows are left open.

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

    FixtureSetUp()

    Sets up the test. Creates and initializes the window if it is null.

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

    FixtureTearDown()

    Tears down the test. When a test fails, closes and recreates the window from scratch. When debugMode is set to true, windows of failed tests are left open.

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

    RecreatePanel()

    Recreates the panel. Calls createWindowFunction if it's set; otherwise, creates the window using CreateInstance(Type).

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

    ReleasePanel()

    Releases the panel. Calls releaseWindowFunction if it's set; otherwise, closes and destroys the window.

    Declaration
    public override void ReleasePanel()
    Overrides
    AbstractUITestFixture.ReleasePanel()
    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)