diff --git a/crates/thing-core/tests/layout.rs b/crates/thing-core/tests/layout.rs index a9ee9a6..657f43e 100644 --- a/crates/thing-core/tests/layout.rs +++ b/crates/thing-core/tests/layout.rs @@ -1161,6 +1161,12 @@ fn scroll_extent_is_measured_from_the_padding_box() { let laid = lay(bx("root", plain(), vec![bx_paint("list", style, paint, rows)]), 400.0, 300.0); let list = laid.nodes.iter().find(|n| n.id.as_str() == "list").unwrap(); assert_eq!(list.max_scroll, Some((68.0, 158.0))); + // Content that fits the padding box scrolls nowhere, though `content` is held at the border box. + let paint = Paint { background: None, border: Some(Border { color: ColorRef::Rgba(Rgba { r: 0, g: 0, b: 0, a: 255 }), width: 4.0 }), radius: 0.0 }; + let small = BoxStyle { overflow: Overflow::Scroll, ..sized(100.0, 100.0) }; + let laid = lay(bx("root", plain(), vec![bx_paint("fit", small, paint, vec![bx("kid", sized(10.0, 10.0), vec![])])]), 400.0, 300.0); + let fit = laid.nodes.iter().find(|n| n.id.as_str() == "fit").unwrap(); + assert_eq!((fit.content, fit.max_scroll), (Some((100.0, 100.0)), Some((0.0, 0.0)))); } #[test]