thing-core test: pin margin and min-size axis conversion in Cells
Finding axis-mutants-survive: the margin-bottom and min-height Y-to-X axis swaps survived the suite. A column of two boxes whose margin and min size state a different Px length on each side now moves a rect under either swap. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
06264314ed
commit
33ea2d4611
1 changed files with 24 additions and 0 deletions
|
|
@ -1437,3 +1437,27 @@ fn a_nonzero_border_side_is_at_least_one_cell_in_cells_so_content_never_sits_und
|
|||
assert_eq!((one.0, one.1), (across, down), "a {width} px border: content starts at ({across}, {down})");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_margin_and_a_min_size_convert_each_side_at_its_own_axis_in_cells() {
|
||||
// Every side of the two slots with a different Px length down than across, so an axis swap on
|
||||
// any one moves a rect: margin-bottom 32 px is 2 rows (not 4), min-height 48 px is 3 rows (not 6).
|
||||
let column = BoxStyle { direction: Direction::Column, align_items: ItemAlign::Start, ..sized(160.0, 160.0) };
|
||||
let a_style = BoxStyle {
|
||||
size: size2(px(8.0), px(16.0)),
|
||||
margin: Edges { top: px(16.0), right: px(24.0), bottom: px(32.0), left: px(8.0) },
|
||||
..plain()
|
||||
};
|
||||
let b_style = BoxStyle { min_size: size2(px(24.0), px(48.0)), ..plain() };
|
||||
let laid = lay_with(&mut MemState::new(), bx("root", column, vec![bx("a", a_style, vec![]), bx("b", b_style, vec![])]), &cells(40.0, 20.0));
|
||||
assert_eq!(rect(&laid, "a"), (1.0, 1.0, 1.0, 1.0), "margin left 8 px is 1 cell across, top 16 px is 1 row down");
|
||||
assert_eq!(rect(&laid, "b").1, 1.0 + 1.0 + 2.0, "a's top margin, a, then its 32 px bottom margin: 2 rows");
|
||||
assert_eq!((rect(&laid, "b").2, rect(&laid, "b").3), (3.0, 3.0), "min size 24 px across is 3 cells, 48 px down is 3 rows");
|
||||
let row = BoxStyle { align_items: ItemAlign::Start, ..sized(160.0, 160.0) };
|
||||
let right = lay_with(&mut MemState::new(), bx("root", row, vec![bx("a", a_style_with_margin_right(), vec![]), bx("b", plain(), vec![])]), &cells(40.0, 20.0));
|
||||
assert_eq!(rect(&right, "b").0, 1.0 + 1.0 + 3.0, "a's 8 px left margin, a (1 cell), then its 24 px right margin: 3 cells");
|
||||
}
|
||||
|
||||
fn a_style_with_margin_right() -> BoxStyle {
|
||||
BoxStyle { size: size2(px(8.0), px(16.0)), margin: Edges { top: px(0.0), right: px(24.0), bottom: px(0.0), left: px(8.0) }, ..plain() }
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue