ui::testing::WindowSeams¶
Header: winui/testing/WindowSeams.hpp.
Installs platform services on a Window: its host, compositor, native host, spell checker and context-menu host. The clipboard and the launcher belong to the whole process instead, so a test swaps them with set_clipboard() and set_launcher().
A window gets these from whatever hosts it. The backend installs the real ones when it creates the native window, and HeadlessUI installs its own. A test uses this to hand the window a test double. Every pointer is non-owning and must outlive the window's use of it; nullptr removes the service. Get one with seams().
Example:
ui::Window window;
ui::testing::TestContextMenuHost menu;
ui::testing::seams(window).set_context_menu_host(&menu);
WindowSeams¶
The seams of window.
set_window_host¶
The host that answers the window's requests (state, title, placement, ...).
window_host¶
The host set_window_host() installed, or nullptr: none yet, or the window was closed.
set_compositor¶
Where composited overlays (shadows, acrylic) are drawn.
set_native_host¶
What creates and places the native windows of NativeControls.
set_spell_checker¶
The spell checker text controls ask.
set_spell_checker_source¶
What makes the spell checker the first time a text control needs one.
set_context_menu_host¶
What shows a text control's context menu.
set_automation_events¶
Where the window reports focus and property changes to automation clients.
handle_close_request¶
The user asked to close the window (the close button, Alt+F4). False when on_closing() vetoed it.
handle_closed¶
The native window is gone.
handle_opened¶
The native window exists and is about to show.
handle_menu_access¶
The menu key: Alt or F10 alone (letter 0), or Alt with a letter nothing else used. True when an element such as a menu bar took it, so the system does nothing more.
report_state¶
The window's state as the OS has it now.
report_state¶
report_state() plus where restore() would land (Window::restores_to()), for a host that knows.
report_active¶
Whether the window is the active one.
report_scale¶
Device pixels per DIP on the window's monitor.
report_caption_insets¶
The room the caption buttons take in a custom title bar.
report_visible¶
Whether the window is shown.
report_blur_behind¶
Whether the desktop behind the window is blurred for a glass frame.
report_caption_icon¶
The small icon the OS shows for the window, as pixels.
report_os_theme¶
The OS theme state, at creation and after every change.
handle_system_menu_item¶
The user picked the app's item index in the system menu.
handle_thumbnail_button¶
The user clicked taskbar thumbnail button index.
effective_style¶
style() with Frame::Themed resolved against the current theme, the style the native window runs with. That is Borderless while the theme draws the frame and Standard when it has none. Every other frame passes through.
drawn_frame_border¶
The width in DIPs of the border the theme draws, which is also the resize band; 0 when the OS draws the frame.
caption_icon¶
The icon a caption the theme draws shows when the window's icon() has no image or glyph of its own, as the host reported it; empty until it reports one.
drawn_title_bar¶
The caption the theme draws, as an automation node (a TitleBar holding the caption buttons) for the host to list before the content; nullptr when the OS draws the frame.
wants_blur_behind¶
Whether the frame the theme draws is glass and wants the desktop behind the window blurred: Aero's frame, while transparency effects are on and the window is not full screen. The host answers with report_blur_behind().
frame_corner_cut¶
The rounded top corners of the frame the theme draws, as the pixels to cut off each top corner, one entry per row from the top, at 96 DPI. Empty for a square frame, while the window is maximized or full screen, and while the frame is glass. The host shapes the window with it.
blur_behind¶
Whether the host reported the blur as live (report_blur_behind()).
handle_pointer¶
A pointer event in client DIPs, routed to popups, the modal layer or the content.
handle_key¶
A key event, routed to the focused element after shortcuts and Tab navigation.
handle_text¶
Typed text for the focused element.
handle_external_drag_enter¶
A drag from another app has come over the window at position, in client DIPs, carrying data. The drop targets there are asked as for a drag inside the app; returns their answer. Refused while a drag inside the app is running.
handle_external_drag_over¶
DragResponse handle_external_drag_over(Point position, std::optional<DataPackageOperation> requested = std::nullopt)
The drag from another app moved to position; requested replaces the operation the package asks for (the keys held changed it). Returns the answer there.
handle_external_drag_leave¶
The drag from another app left the window, or was canceled.
handle_external_drag_drop¶
The drag from another app was released at position. Returns what the drop did, None when nothing took it.
handle_external_drop¶
Files dropped on the window from another app at position, reported only on release: the enter and the drop at once. Returns what the drop did, None when nothing took it.
handle_context_menu¶
A context-menu request at position, or from the keyboard when nullopt. True when handled.
handle_automation_invoke¶
An automation client invoking element, as a screen reader does to press a button. True when it was invoked.
handle_native_context_menu¶
A context-menu request from a hosted native control. True when handled.
handle_native_content_changed¶
A hosted native control's content changed.
handle_native_notification¶
A notification from a hosted native control. True when the control handled it.