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 to write Play mode tests for UI Toolkit content.
By default, the runtime panel uses the default runtime theme. To customize the theme during tests, set themeStyleSheet. The test fixture creates an empty runtime panel with no `UIDocument` attached. To provide your own UI content for testing, call SetUIContent(UIDocument).
Constructors
RuntimeUITestFixture()
Instantiates a new empty RuntimeUITestFixture.
Declaration
protected RuntimeUITestFixture()
Properties
panelSize
The size of the rootVisualElement of the panel.
Declaration
public override sealed Vector2 panelSize { get; set; }
Property Value
| Type | Description |
|---|---|
| Vector2 |
Overrides
Methods
ApplyPanelSize()
Applies the panelSize to the panel.
Declaration
public void ApplyPanelSize()
CreateDefaultUIScene()
Sets up a GameObject with an empty UIDocument.
Use themeStyleSheet to set the style sheet.
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
FixtureUnityTearDown()
Tears down the test using coroutines.
Declaration
public override IEnumerator FixtureUnityTearDown()
Returns
| Type | Description |
|---|---|
| IEnumerator | An IEnumerator for yield instructions |
Overrides
RecreatePanel()
Recreates the simulated UI Toolkit panel, providing a fresh instance.
If you set a custom UIDocument using SetUIContent(UIDocument),
it disables the associated GameObject and re-enables it instead of recreating.
Declaration
public override void RecreatePanel()
Overrides
ReleasePanel()
Destroys created scene components and 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 |