docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    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.

    Inheritance
    object
    UITestComponent
    MenuSimulator
    PopupMenuSimulator
    Inherited Members
    MenuSimulator.menuIsDisplayed
    MenuSimulator.menuItemCount
    MenuSimulator.SimulateItemSelection(int)
    MenuSimulator.SimulateMenuSelection(string)
    MenuSimulator.FindActionIndex(string)
    MenuSimulator.AssertContainsAction(string)
    MenuSimulator.AssertContainsAction(string, DropdownMenuAction.Status)
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    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
    MenuSimulator.AfterTest()

    BeforeTest()

    This function will be invoked when the AddTestComponent(UITestComponent) function is called.

    Declaration
    protected override void BeforeTest()
    Overrides
    MenuSimulator.BeforeTest()

    DiscardMenu()

    Resets relevant MenuSimulator properties. Resets the menu state, hides the menu, and clears any menu data.

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