Class PopupMenuSimulator
Provides a testable wrapper for both Editor and Runtime popup menu interactions in UI Toolkit tests. Allows simulation and verification of popup menu display, item selection, and menu content without invoking the native system menu.
Inherited Members
Namespace: UnityEngine.UIElements.TestFramework
Assembly: Unity.UI.TestFramework.Runtime.dll
Syntax
public sealed class PopupMenuSimulator : MenuSimulator
Properties
anchored
True if the menu is anchored, false otherwise.
Declaration
public bool anchored { get; }
Property Value
| Type | Description |
|---|---|
| bool |
position
The position of the menu.
Declaration
public Rect position { get; }
Property Value
| Type | Description |
|---|---|
| Rect |
targetElement
The element used to determine the menu's root.
Declaration
public VisualElement targetElement { get; }
Property Value
| Type | Description |
|---|---|
| VisualElement |
Methods
AfterTest()
This function will be invoked when the RemoveTestComponent(UITestComponent) function is called.
Declaration
protected override void AfterTest()
Overrides
BeforeTest()
This function will be invoked when the AddTestComponent(UITestComponent) function is called.
Declaration
protected override void BeforeTest()
Overrides
DiscardMenu()
Resets relevant MenuSimulator properties. Resets the menu state, hides the menu, and clears any menu data.
Declaration
public override void DiscardMenu()