Fire a Slint callback as if the user triggered it in the window. The
name may be kebab-case or camelCase; args are the callback arguments.
Follow it with await host.settle() before asserting.
The test types "cat" into the window's search box and checks the
plugin's results. emit delivers the Slint callback search-changed
with its argument to the plugin's on handler; settle() waits for the
properties the handler wrote.
const search = host.window("search");
search.emit("searchChanged", "cat"); // camelCase or kebab-case
await host.settle();
assert.ok((search.props["results"] as unknown[]).length > 0);
The user closes the window with its title-bar button: the window closes
and the plugin's window.onClose listeners run (unlike the plugin's own
close()).
The test closes the plugin's window with its title-bar button and checks
that the plugin stopped its timer. Unlike the plugin's own close(),
userClose runs the plugin's onClose listeners.
host.window("clock").userClose();
await host.settle();
assert.equal(host.window("clock").visible, false);
The .slint file the window was created from (package-relative).
Whether the window is shown (show()) or hidden (hide()).
The properties the plugin wrote, by their Slint (kebab-case) names:
canMark is stored as can-mark. Runtime images appear in their wire
form; read the path with TestHost.imagePath.
The Slint callback names (kebab-case) the plugin bound with on().
A tool window as the test host keeps it: the record of a
plugin.windows.create(...)window after its firstshow(). Get one with TestHost.window.Example: Change a setting in a tool window from a test
The test opens the plugin's Picture window, moves its brightness control and checks that the plugin wrote the value back.
emitfires a Slint callback as if the user used the control; the plugin'sonhandler runs and sets properties, which reach the host as requests, sosettle()waits for them beforepropsis read.Remarks
A record, not a window: no Slint file is compiled and nothing is drawn.
propsholds what the plugin wrote, by Slint name;emitfires a callback the way the user's input would;userClosecloses it the way the title-bar button would.Since
1.0.0