pub struct TestSequence<'a> { /* private fields */ }Expand description
Builder returned by TestBackend::sequence.
Chain step builders (tick, key, type_string, events) and finalize
with run. Steps execute sequentially, advancing
FrameState between them so focus and hooks evolve naturally without the
caller having to thread state.
Implementations§
Source§impl<'a> TestSequence<'a>
impl<'a> TestSequence<'a>
Sourcepub fn tick(self, f: impl FnOnce(&mut Context) + 'a) -> Self
pub fn tick(self, f: impl FnOnce(&mut Context) + 'a) -> Self
Append a step that renders without injecting any events.
Equivalent to a single frame tick — useful for letting hooks / animations advance between input steps.
Sourcepub fn key(self, code: KeyCode, f: impl FnOnce(&mut Context) + 'a) -> Self
pub fn key(self, code: KeyCode, f: impl FnOnce(&mut Context) + 'a) -> Self
Append a step that fires a single key-press event with no modifiers.
Sourcepub fn type_string(self, s: &str, f: impl FnOnce(&mut Context) + 'a) -> Self
pub fn type_string(self, s: &str, f: impl FnOnce(&mut Context) + 'a) -> Self
Append a step that types s as a sequence of KeyCode::Char events
before invoking render.
Unlike TestBackend::type_string, this collapses every typed
character into a single render step — useful when the per-character
frame state is not the assertion target. For per-keystroke rendering,
chain individual .key(...) calls.
Sourcepub fn events(
self,
events: Vec<Event>,
f: impl FnOnce(&mut Context) + 'a,
) -> Self
pub fn events( self, events: Vec<Event>, f: impl FnOnce(&mut Context) + 'a, ) -> Self
Append a step with an arbitrary event batch.
Useful for mouse interactions, paste events, or sequences built
with EventBuilder.
Sourcepub fn run(self)
pub fn run(self)
Execute every queued step in order. Returns control to the caller
(the TestBackend is borrowed mutably for the lifetime of the
sequence builder). Use TestBackend::buffer / .frames() /
.assert_* after run() returns.