#[test] fn flex_grow_within_constrained_max_width() { let mut sprawl = sprawl::Sprawl::new(); let node00 = sprawl .new_node( sprawl::style::Style { flex_grow: 1f32, size: sprawl::geometry::Size { height: sprawl::style::Dimension::Points(20f32), ..Default::default() }, ..Default::default() }, &[], ) .unwrap(); let node0 = sprawl .new_node( sprawl::style::Style { max_size: sprawl::geometry::Size { width: sprawl::style::Dimension::Points(300f32), ..Default::default() }, ..Default::default() }, &[node00], ) .unwrap(); let node = sprawl .new_node( sprawl::style::Style { flex_direction: sprawl::style::FlexDirection::Column, size: sprawl::geometry::Size { width: sprawl::style::Dimension::Points(200f32), height: sprawl::style::Dimension::Points(100f32), ..Default::default() }, ..Default::default() }, &[node0], ) .unwrap(); sprawl.compute_layout(node, sprawl::geometry::Size::undefined()).unwrap(); assert_eq!(sprawl.layout(node).unwrap().size.width, 200f32); assert_eq!(sprawl.layout(node).unwrap().size.height, 100f32); assert_eq!(sprawl.layout(node).unwrap().location.x, 0f32); assert_eq!(sprawl.layout(node).unwrap().location.y, 0f32); assert_eq!(sprawl.layout(node0).unwrap().size.width, 200f32); assert_eq!(sprawl.layout(node0).unwrap().size.height, 20f32); assert_eq!(sprawl.layout(node0).unwrap().location.x, 0f32); assert_eq!(sprawl.layout(node0).unwrap().location.y, 0f32); assert_eq!(sprawl.layout(node00).unwrap().size.width, 200f32); assert_eq!(sprawl.layout(node00).unwrap().size.height, 20f32); assert_eq!(sprawl.layout(node00).unwrap().location.x, 0f32); assert_eq!(sprawl.layout(node00).unwrap().location.y, 0f32); }