Post task updates to the loop instead of waking it

`WakeTaskQueue` becomes `TaskQueue`, which carries the update itself.
Delivery and waking are then one act: the winit host sends it through the
`EventLoopProxy` as a `DefaultEvent::Update`, so there is no channel
beside the loop and nothing has to claim a redraw is needed in order to be
looked at. `Window::request_redraw` is gone from this path; `event`
applies the update and then asks the tree whether anything became dirty,
which is the same question `window_event` already ended with -- now
`schedule_redraw`, called from both.

The loop's message type is `DefaultEvent<State>`, so `Proxy` becomes a
wrapper that takes the application's own `Event` and requires it to be
`Send`, since it now crosses to the task thread by that route.

The harness supplies a channel-backed queue, which is what lets a test
hold updates until it asks for them.

Tests split by subject -- layout, pointer, scroll, tasks -- with the
region helper in `tests/common`.
This commit is contained in:
iris committed 2026-09-13 21:04:29 -04:00
1 parent e97aba30e0
commit 3a74a04a5b
13 files changed
+266 -302

No files matched your search

+29
View File
@@ -0,0 +1,29 @@
//! Scrolling moves content and stops at its ends.
mod common;
use common::corners;
use iris::harness::Harness;
use iris::prelude::*;
#[test]
fn a_wheel_scrolls_the_content_and_stops_at_its_end() {
let mut h = Harness::new((400, 200));
// Twice the window's height, so there is 200 to scroll.
let top = rect(Color::RED).height(200).add(&mut h.rsc);
let bottom = rect(Color::BLUE).height(200).add(&mut h.rsc);
h.set_root((top, bottom).span(Dir::DOWN).scrollable());
h.move_to((200, 100));
// `Scroll` starts snapped to the end.
assert_eq!(corners(&h, &top).1, -200.0);
// The handler scales a wheel line by 50.
h.scroll((0, 1));
h.frame();
assert_eq!(corners(&h, &top).1, -150.0);
h.scroll((0, 10));
h.frame();
assert_eq!(corners(&h, &top).1, 0.0);
}