layout tests: each edge of the bound refuses
This commit is contained in:
parent
ed5b72efab
commit
d338f23356
1 changed files with 18 additions and 0 deletions
|
|
@ -953,3 +953,21 @@ fn large_siblings_on_one_axis_are_exact_or_refused() {
|
|||
}
|
||||
assert!(exact > 0 && refused > 0, "exact {exact}, refused {refused}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn each_edge_of_the_precision_bound_refuses() {
|
||||
let refused = |root: Node| {
|
||||
let tree = bind(&mut MemState::new(), &surface_of(root)).unwrap();
|
||||
matches!(layout(&tree, &pixels(800.0, 600.0, 1.0), &mut FixedMeasure::pixels(&[])), Err(LayoutError::OutOfRange(_)))
|
||||
};
|
||||
let column = BoxStyle { direction: Direction::Column, ..plain() };
|
||||
// The bottom edge alone is past the bound: the top is not.
|
||||
assert!(refused(bx("root", column.clone(), vec![embed("a", 10.0, 16.0), embed("b", 10.0, 2_097_152.0)])));
|
||||
// The right edge alone.
|
||||
assert!(refused(bx("root", plain(), vec![embed("a", 16.0, 10.0), embed("b", 2_097_152.0, 10.0)])));
|
||||
// A position past the bound on the negative side.
|
||||
let pull = BoxStyle { margin: Edges { left: px(-2_097_152.0), ..edges(px(0.0)) }, ..plain() };
|
||||
assert!(refused(bx("root", plain(), vec![bx("outer", pull.clone(), vec![bx("inner", pull, vec![embed("e", 1.0, 1.0)])])])));
|
||||
// Whole layouts at the bound are fine.
|
||||
assert!(!refused(bx("root", column, vec![embed("a", 10.0, 2_097_152.0)])));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue