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.

Nothing here is reached from an app binary’s own modes: those use super::headless, so a release app carries none of this module.

Re-exports§

pub use super::headless::HeadlessApp;
pub use super::headless::HostedApp;
pub use super::headless::surface_in;

Constants§

SIDEBAR_BUTTON_WINDOWS
The windows check_window_sidebar_button opens an app in: one wide enough to dock a sidebar beside any content, and one so narrow the sidebar is a screen of its own or a drawer over the content.

Functions§

check_window_sidebar_button
Open the app with open in each of SIDEBAR_BUTTON_WINDOWS, shown in the desktop’s window bar, and click the bar’s sidebar button three times there: every click flips the sidebar, on the bar, in the window’s shell and on screen (FrameHarness::check_window_sidebar_button).
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.
drive_live_window_writing_after
drive_live_window, with the window’s record written debounce after the last edit instead of the window’s own [app_state::DEFAULT_DEBOUNCE]. The store writes on a thread of its own and wakes the window when the write lands, so whether a frame observed while typing takes that wake depends on how long the frames before it took. A debounce longer than the test holds every write past what it observes.
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_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.
window_record
The record window instance of A kept in the test workspace 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.