Replace placement calls with region nodes

This commit is contained in:
iris-ai committed 2026-09-15 18:02:28 -04:00
1 parent f437495309
commit 71c9c39523
23 files changed
+374 -170

No files matched your search

+8 -9
View File
@@ -1,10 +1,9 @@
//! Random trees, checked against building the same tree cold.
//!
//! A frame reaches its layout by keeping most of the last one: slots
//! rewritten, some widgets drawn again, the rest untouched. The property here
//! is that what comes out is the tree a cold start would have produced, so
//! anything the retained path carried over that it should not have shows up
//! as a difference in somebody's box.
//! A frame reaches its layout by keeping most of the last one: movable regions
//! or primitive boxes rewritten, some widgets drawn again, the rest untouched.
//! The result must be the tree a cold start would have produced, so anything
//! wrongly retained shows up as a difference in somebody's box.
//!
//! `iris::random` grows the tree and `examples/random.rs` draws one. A seed is
//! the whole reproduction; `a_long_run_of_seeds_agrees` is the ignored sweep
@@ -220,8 +219,8 @@ fn describe(id: WidgetId, h: &Harness) -> String {
}
/// Every widget in one tree against the matching widget in the other. A
/// mismatch prints the widget's ancestry, marking the ones that own a slot,
/// since where two trees disagree is rarely where the cause is.
/// mismatch prints the widget's ancestry, marking region nodes, since where
/// two trees disagree is rarely where the cause is.
fn assert_same(seed: u64, what: &str, warm: (&Harness, &Tree), cold: (&Harness, &Tree)) {
let ((wh, wt), (ch, ct)) = (warm, cold);
assert_eq!(wt.ids.len(), ct.ids.len(), "seed {seed}: different trees");
@@ -243,11 +242,11 @@ fn assert_same(seed: u64, what: &str, warm: (&Harness, &Tree), cold: (&Harness,
let mut at = Some(w);
while let Some(id) = at {
let active = &wh.render.active[&id];
let slot = match active.move_idx == active.parent_move {
let node = match active.move_idx == active.parent_move {
true => "",
false => "*",
};
chain.push(format!("{}{slot}", describe(id, wh)));
chain.push(format!("{}{node}", describe(id, wh)));
at = active.parent;
}
println!(