ui::testing::TestAutomationEvents¶
Header: winui/testing/TestAutomationEvents.hpp.
Derives from ui::AutomationEvents.
AutomationEvents test double: keeps a line of text for every event a window reports, the way a screen reader would hear about it. Structure changes go to structure instead, as they come with many changes and say little on their own.
Install it with seams(window).set_automation_events(); the window then reports to it after each layout. Set listening_now to false to act as if no screen reader is listening, and the window reports nothing.
Example:
ui::testing::TestAutomationEvents events;
ui::testing::seams(window).set_automation_events(&events);
ui::testing::seams(window).handle_key({ui::Key::Tab, ui::KeyAction::Down});
REQUIRE(events.log == std::vector<std::string>{"focus Button \"Save\""});
listening_now¶
Whether the window should report; true by default.
log¶
One line per event: focus <role> "<name>", or <property> "<name>": <before> -> <after>.
focused¶
The node of each focus event, in order.
structure¶
The node of each structure change, in order.
listening¶
Whether a client is listening; while false the window skips the checks.
focus_changed¶
node took keyboard focus as automation sees it.
property_changed¶
void property_changed(Element& node, AutomationProperty property, const AutomationValue& before, const AutomationValue& after) override
property of node, the node with automation focus, went from before to after.
menu_opened¶
A menu (a node with AutomationRole::Menu) opened.
menu_closed¶
A menu closed.
structure_changed¶
node's automation children changed: one came, went or was renamed.