Skip to main content

Module testing

Module testing 

Source
Expand description

Headless widget-level test harness: WidgetHarness drives a bare Interaction<Id>/Ui against Headless, without an App.

retroglyph_core::testing::TestHarness is the right tool once a whole app exists to drive, but it’s generic over A: App<Headless>, so a widget or a bare Interaction<Id> needs a throwaway App impl just to reach it. A widget test that only needs a few multi-frame sequences gets away with Interaction::new()/begin_frame() inline instead (see crates/ui/src/widget/button.rs’s own tests), but that stops scaling once a widget’s suite is built from repeated click/assert sequences: Menu’s tests (crates/ui/src/widget/menu.rs) are exactly that shape, each hand-rolling the same register-hits/feed-events/resolve frame pair WidgetHarness now does once. Feature-gated (testing), no effect on release builds.

Structs§

WidgetHarness
Drives a bare Interaction<Id> against a Headless backend: queues synthetic input, steps a frame through a caller-supplied draw closure, and reads back the rendered view.