From 4d2414e1a1da33dd42e965f89efc805e741489fd Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sat, 28 Nov 2026 05:34:22 +0100 Subject: [PATCH] layout tests: unique ids, depth at the resolver bound --- crates/thing-core/tests/layout.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/crates/thing-core/tests/layout.rs b/crates/thing-core/tests/layout.rs index 1401f52..5e427d9 100644 --- a/crates/thing-core/tests/layout.rs +++ b/crates/thing-core/tests/layout.rs @@ -650,20 +650,20 @@ fn depth() { let tree = bind(&mut state, &document).unwrap(); assert!(run_default_thread(&tree).nodes.len() > 20); - // Every display kind at 1,024 levels lays out on a default thread. The tree is built and + // Every display kind at 1,024 levels (the resolver STACK_BOUND, the leaf included) lays out on a default thread. The tree is built and // dropped on a roomy one: only layout is held to the default stack. for kind in KINDS { let nodes = std::thread::Builder::new() .stack_size(128 * 1024 * 1024) .spawn(move || { - let document = surface_of(chain(kind, 1024)); + let document = surface_of(chain(kind, 1023)); let tree = bind_with(&mut MemState::new(), &document, deep_limits()).unwrap(); run_default_thread(&tree).nodes.len() }) .unwrap() .join() .unwrap(); - assert_eq!(nodes, 1025, "{kind:?}"); + assert_eq!(nodes, 1024, "{kind:?}"); } } @@ -695,10 +695,12 @@ fn stack_per_level() { #[test] fn extreme_values_never_panic() { let huge = |v: f64| px(v); + let count = std::cell::Cell::new(0); let boxed_with = |mutate: &dyn Fn(&mut BoxStyle)| { let mut style = sized(10.0, 10.0); mutate(&mut style); - bx("child", style, vec![embed("e", 5.0, 5.0)]) + count.set(count.get() + 1); + bx(&format!("child{}", count.get()), style, vec![embed(&format!("e{}", count.get()), 5.0, 5.0)]) }; let root = bx("root", plain(), vec![ boxed_with(&|s| s.size = size2(huge(3e38), huge(3e38))),