Constrain offered boxes with independent widget size bounds

This commit is contained in:
iris-ai committed 2026-09-20 19:47:32 -04:00
1 parent 4cb6f6882a
commit 2ac0843cb2
18 files changed
+554 -379

No files matched your search

+3 -14
View File
@@ -200,8 +200,8 @@ fn mark(warm: &mut Harness, tree: &Tree, step: usize) {
fn a_rule(rng: &mut Rng) -> SizeRule {
let len = Len::px(20.0 + rng.below(180) as f32);
match rng.below(4) {
0 => SizeRule::Max(len),
1 => SizeRule::Min(len),
0 => SizeRule::max(len),
1 => SizeRule::min(len),
_ => LayoutLen::from(len).into(),
}
}
@@ -357,18 +357,7 @@ fn change(case: Case, warm: &mut Harness, tree: &mut Tree, plan: &Plan, rng: &mu
/// buildable from what the failure printed.
fn describe(id: WidgetId, h: &Harness) -> String {
let rules = h.rsc.widgets().size_rules(id).clone();
// A bound prints as itself: a failure is reproduced from what it printed,
// and a rule shown as "no rule" cannot be written out again.
let rule = |r: SizeRule| match r {
SizeRule::Free => "-".into(),
SizeRule::Exact(len) => format!("{len}"),
SizeRule::Request(request) => format!("{request:?}"),
SizeRule::Min(min) => format!(">{}", LayoutLen::from(min)),
SizeRule::Max(max) => format!("<{}", LayoutLen::from(max)),
SizeRule::Clamp { min, max } => {
format!(">{}<{}", LayoutLen::from(min), LayoutLen::from(max))
}
};
let rule = |r: SizeRule| format!("{r:?}");
let align = h.rsc.widgets().alignment(id);
let side = |a: AxisAlign| {
if a == AxisAlign::NEG {