board: regression test for a kept resolution of the focused stop's edits

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Martin Ball
2026-11-20 01:30:21 +00:00
co-authored by Claude Opus 5.5
parent f73cb0d60a
commit a2085c5505
@@ -292,6 +292,27 @@ fn a_settled_region_runs_when_the_focused_stops_answer_changes() {
assert!(!frames.tree().is_disabled(cut.get()), "which shows Cut enabled");
}
/// A kept resolution of a command the focused stop answers for (Cut, which a text field takes) follows that stop's
/// answer as the pass's end hook records it, so a read between passes (a test after its frames) is current: with the
/// field's text selected, Cut is enabled at once, not only once another pass begins.
#[trial]
fn a_read_between_passes_follows_the_focused_stops_answer() {
let text = RefCell::new("hello".to_owned());
let field = Cell::new(Id::NULL);
let mut show = |ui: &mut Ui| {
field.set(TextField::new("Name", Bind::bound(&mut *text.borrow_mut())).show(ui).response.id);
};
let mut frames = Frames::new();
frames.idle(2, &mut show);
request(&frames.ctx, FocusTarget::Id(field.get()));
frames.idle(30, &mut show);
assert!(!resolve(&frames.ctx, EditCommands::Cut).enabled, "Cut does nothing with no text selected");
frames.frame(vec![key_press(Key::A, Modifiers::COMMAND)], &mut show);
// The field's new answer reaches the focus record in the next pass's end hook; no pass has begun since.
frames.frame(vec![], &mut show);
assert!(resolve(&frames.ctx, EditCommands::Cut).enabled, "Cut is enabled with the text selected");
}
/// The testing check every 100th pass compares every kept resolution with a full one, and every kept gate answer with
/// the gate's. The script changes, a few passes before each check, every kind of input a resolution reads: app and
/// published states, the gate, the keymap, the focus and the focused stop's edits, a menu and a modal layer with readers