Skip to main content

Module testing

Module testing 

Source
Expand description

Testing a framework app the way it runs: the real component runtime, storage, permissions, undo and history, without a window.

Prefer tilo_resource::Replica for the resource’s own behaviour (it needs no UI). Use TestApp to prove what the host adds: that controls invoke actions, that undo reverts them, that a viewer is refused, that state survives a reopen.

Structs§

HeadlessApp
One framework app mounted headlessly: a test, a fixture seeder or an inspection tool drives it through the real runtime.

Functions§

detached_dispatcher
A dispatcher outside any host, for a unit test of a surface (or of the model behind it) that edits through one: each immediate action ([Dispatcher::apply_now]) applies to the document handed to it, attributed to author, through the same executor as a hosted one, so the test exercises the surface’s real write path. Queued invocations ([Dispatcher::apply]) are not taken by anyone: drive those through TestApp.
detached_live
The live state of doc, for a surface a unit test attaches outside any host (see detached_dispatcher); the surface keeps it current from the document its sync receives, as in a host.
dispatcher
A dispatcher of R for testing a surface’s own methods without a host: the edits it applies now ([Dispatcher::apply_now]) go through the same replayable executor a hosted surface’s do, attributed to a test author, onto the document the test hands the surface. Invocations it queues are resolved by a host only; test those through TestApp.
drive_live_embedded
drive_live_window with the window shown in a region of a host’s scene, as the shell shows an in-process app: the real app in a ui_core::app::EmbeddedApp, which the drive lays out, draws into its own scene and feeds input through [ui_core::app::EmbeddedApp::input_for_test].
drive_live_window
Drive the window A’s live launch opens, mounted as inspect_live_window mounts it: the real ui_core::App, which a test or benchmark feeds input through ui_core::App::surface_input.
inspect_live_window
Inspect the window A’s live launch opens: the same definition and component, mounted in a native ui_core::App on a fresh private profile, without running its event loop. For what the window itself declares, such as capture protection.
resolve
Resolve what dispatcher (dispatcher) queued since the last call — its actions, typed values and groups — onto doc as a host does after an event, as confirmed: each invocation one step, attributed to the test author. An action its resource refuses (its clip is gone) changes nothing and is reported through [Dispatcher::refused], as the host reports it. Returns what each applied invocation applied, in order: one entry per undo step (a group’s entry holds all of its actions).
search_source
The search source the framework builds for R from entries — its resource’s and its surfaces’ — for testing what an app’s entries find and how their hits read without a window.
surface_in
The custom surface of type S that A’s view hosts in harness, without running a frame (see with_surface).
surface_in_root
The custom surface of type S that A’s view hosts, when widget is A’s root as a host mounted it: a tab of A in a shell, found in the host’s own widget map.
surface_report
What A publishes and how its view binds to it, as tilo-app surface commits it and tilo-app check compares it: the resource’s Surface and those of the person’s records its views open, every control its view, built headless on an empty record, binds to something the resource does not publish, the ids of its effects and named views, and the ids the framework keeps for its own actions (reserved_action_ids).
window_record
The record window instance of A kept in the test room while A kept one per window: stamped with that window’s default identity, initialized as A creates a record, then edited with actions. Open the app over such records with HeadlessApp::with_window_records.
with_surface
Run visit on the custom surface of type S that A’s view hosts in harness (what ViewCx::surface mounted), then the frames that follow; None when the view hosts no such surface at its root. For a test that drives a component mounted another way than HeadlessApp (two windows over one record).

Type Aliases§

TestApp
The name tests use for HeadlessApp.