Class RuntimeUITestFixture
Test fixture base class that creates a Runtime panel.
Inherited Members
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
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
FixtureOneTimeTearDown()
Tears down the test fixture.
Declaration
public override void FixtureOneTimeTearDown()
Overrides
FixtureSetUp()
Sets up the test.
Declaration
public override void FixtureSetUp()
Overrides
FixtureTearDown()
Tears down the test.
Declaration
public override void FixtureTearDown()
Overrides
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
ReleasePanel()
Destroys created scene components.
Destroys the UIDocument.
Declaration
public override void ReleasePanel()
Overrides
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 |