Account for the canvas keyboard notification in Escape tests

This commit is contained in:
2026-09-12 23:03:31 -07:00
parent 0d8c144355
commit c28abcf13a
@@ -787,7 +787,8 @@ async fn find_close_releases_removed_input_and_guarded_focus_respects_later_inpu
/// Feed the real App subscription recipes the status produced by a mounted
/// TextInput. Poll only immediately available output: no timer wait, worker,
/// file dialog or App task is executed by this helper.
/// file dialog or App task is executed by this helper. Require the canvas keyboard
/// notification separately, then return every command routed to an Escape owner.
fn captured_input_subscription_messages(app: &App) -> Vec<Message> {
use iced::advanced::{Layout, Shell, layout, subscription, widget};
use iced::futures::{StreamExt, stream, task::noop_waker_ref};
@@ -847,6 +848,7 @@ fn captured_input_subscription_messages(app: &App) -> Vec<Message> {
.unwrap();
let _entered = runtime.enter();
let mut messages = Vec::new();
let mut keyboard_boundaries = 0;
for recipe in subscription::into_recipes(app.subscription()) {
let mut output = recipe.stream(Box::pin(stream::iter([event.clone()])));
let mut context = Context::from_waker(noop_waker_ref());
@@ -855,9 +857,20 @@ fn captured_input_subscription_messages(app: &App) -> Vec<Message> {
!matches!(message, Message::CheckpointTick),
"timer must remain pending"
);
messages.push(message);
if matches!(
&message,
Message::WorkDrag(crate::app::allocation_drag::Event::KeyboardBoundary)
) {
keyboard_boundaries += 1;
} else {
messages.push(message);
}
}
}
assert_eq!(
keyboard_boundaries, 1,
"each key has exactly one passive allocation notification"
);
messages
}