thing-core test: pin the half-a-side cap of the control inset
Mutation survivors of Device::inset (`w / 2.0` and `h / 2.0` replaced by a product): a control narrower than twice its inset keeps the content box inside the border box. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
77e66090dd
commit
2831732eb7
1 changed files with 11 additions and 0 deletions
|
|
@ -1374,3 +1374,14 @@ fn a_pixels_control_inset_is_two_logical_px_and_a_pixels_button_has_none() {
|
|||
assert_eq!(inside(&button, "button"), None, "Pixels lays a Button's content without an inset");
|
||||
assert_eq!(inside(&button, "label"), None, "and a node that is no control has no content box");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_control_smaller_than_its_inset_gives_up_half_of_each_side_at_most() {
|
||||
// A 2x2 px grid track holds an input whose 2 px chrome on each side would eat the box twice:
|
||||
// the inset is capped at half a side, so the content box is empty and in the middle.
|
||||
let grid = BoxStyle { display: Display::Grid, grid_columns: vec![px(2.0)], grid_rows: vec![px(2.0)], ..sized(10.0, 10.0) };
|
||||
let tree = bind(&mut MemState::new(), &surface_of(bx("root", grid, vec![bordered("input")]))).expect("resolves");
|
||||
let laid = layout(&tree, &pixels(100.0, 100.0, 1.0), &mut FixedMeasure::pixels()).unwrap();
|
||||
assert_eq!(rect(&laid, "input"), (0.0, 0.0, 2.0, 2.0));
|
||||
assert_eq!(inside(&laid, "input"), Some((1.0, 1.0, 0.0, 0.0)));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue