layout tests: fit-content is judged on the cross axis

This commit is contained in:
Meta Vens 2026-11-28 05:16:24 +01:00
commit 2943c685ed

View file

@ -475,8 +475,9 @@ fn item_alignment_and_content_arms() {
#[test]
fn available_space_is_logical() {
// A shrink-to-fit box wraps its text at the room it is offered: 100 logical px at any scale.
let wrapped = BoxStyle { size: size2(Dimension::Content, Dimension::Auto), shrink: 0.0, ..plain() };
let root = bx("root", sized(100.0, 600.0), vec![bx("wrap", wrapped, vec![text("t", &"xxxx ".repeat(10))])]);
let wrapped = BoxStyle { size: size2(Dimension::Content, Dimension::Auto), ..plain() };
let column = BoxStyle { direction: Direction::Column, align_items: ItemAlign::Start, ..sized(100.0, 600.0) };
let root = bx("root", column, vec![bx("wrap", wrapped, vec![text("t", &"xxxx ".repeat(10))])]);
for scale in [1.0, 2.0] {
let laid = lay_with(&mut MemState::new(), root.clone(), &pixels(800.0, 600.0, scale));
assert_eq!(rect(&laid, "wrap").2, 100.0 * scale);