Skip to content

ui::testing::ElementAccess

Header: winui/testing/ElementAccess.hpp.

What a test needs from an Element that only its window or container calls in an app.

clear_dirty

static void clear_dirty(Element& element, DirtyFlags flags = DirtyFlags::All)

Clears flags on element and its subtree, as the window does after drawing a frame.

sync_composition

static void sync_composition(Element& element, detail::Compositor& compositor, const Theme& theme)

Runs the composition update the window runs after layout and input, against compositor, the test compositor.

set_focused

static void set_focused(Element& element, bool focused)

Shows element focused or not, as its window does when keyboard focus arrives or leaves.

set_focus_visible

static void set_focus_visible(Element& element, bool visible)

Sets element's focus-visible state, as its window does when the input modality changes.

static PopupRequest* popup_request(const Element& element)

The popup element has open (Element::open_popup()), or null.

dismiss_popup

static void dismiss_popup(Element& element, PopupCloseReason reason = PopupCloseReason::LightDismiss)

Dismisses element's popup as the window does on a press outside it or Escape.

place_popup

static bool place_popup(Element& element, Element& content, Size client, const MeasureContext& context)

Runs element's popup place callback as the window does; returns false without one.

collect_live

static void collect_live(Element& element, std::vector<Element*>& out)

The elements the window asks for popups, tool tips, global shortcuts and focus requests, from element down.

layers_composed

static bool layers_composed(const Element& element)

Whether the compositor shows element's layers instead of the frame.