Run a ui without a window, and test one
`Tasks` held an `Arc<Window>` only to call `request_redraw` when a task finished, which made the task queue -- and so `DefaultRsc` -- impossible to build without a window. It now takes an `Arc<dyn WakeTaskQueue>`, and `Window` implements it. Waking moves from "the task ended" to "an update was sent", which is when there is something for the host to apply: a task that keeps running after sending one no longer holds its update until it finishes, and a task that sends none no longer asks for a frame it does not need. `iris::harness` is what that buys. `UiRenderState` already does layout, hit testing and primitive building with no surface, so a test can build a tree, run frames, move a pointer and read back where widgets landed. `tests/harness.rs` does each of those; none of them could be written before, since the only entry point to layout was a window. It does not draw. A claim about pixels still needs a real surface.
This commit is contained in:
1 parent
00d2230b84
commit
d5efdd2b97
6 files changed
+370
-12
No files matched your search
@@ -34,6 +34,10 @@ impl UiRenderState {
|
||||
self.resized = true;
|
||||
}
|
||||
|
||||
pub fn output_size(&self) -> Vec2 {
|
||||
self.output_size
|
||||
}
|
||||
|
||||
pub fn update<'a>(&mut self, root: impl Into<Option<&'a StrongWidget>>, rsc: &mut dyn UiRsc) {
|
||||
// safety mechanism for memory leaks; might wanna return a result instead so user can
|
||||
// decide whether to panic or not
|
||||
|
||||
Reference in new issue
Block a user