Incular logoIncular
API ReferencePlatform & Testing

Simulation Testing

In-process input driving, frame capture, and diagnostics with every method.

Drive the normalized input/event path in-process — no OS input injection, no desktop capture.

StepPurpose
app.simulation()In-process harness handle
tap / key_press / type_textDrive normalized input
scroll_byDrive scroll physics
frame()Rebuild → layout → paint → composite
screenshot()Capture the rendered frame
use incular::prelude::*;

fn main() {
    let app =
        Application::new(|_cx| Text::new("Tested").into()).expect("valid application");
    let sim = app.simulation();
    sim.type_text("hello").expect("type");
    sim.wait_for_frame().expect("frame");
    println!("framed ok");
}

SimulationError covers invalid targets and harness misuse. Per-example tests/ harnesses validate behavior this way; workspace integration tests live in crates/incular/tests/. Native GUI scenarios still run locally before release; CI performs build checks.

Frame and performance diagnostics

Frame and performance diagnostics are read from the runtime hub: hub.snapshot(), hub.version(), hub.set_observed(true), overlay_lines(&snapshot), and scheduler_counters().

ProfilerMode: Normal (default) / Diagnostic / Profiling. FrameRecord carries timings (event, build, layout, composite, semantics, paint), work counts (elements rebuilt, objects laid out/repainted, layers, animations, display-list commands), and over-budget flags.

Related: DevTools, Application.

On this page