1#[test]
2fn flex_grow_height_maximized() {
3 let mut taffy = taffy::Taffy::new();
4 let node00 = taffy
5 .new_node(
6 taffy::style::Style {
7 flex_grow: 1f32,
8 flex_basis: taffy::style::Dimension::Points(200f32),
9 ..Default::default()
10 },
11 &[],
12 )
13 .unwrap();
14 let node01 = taffy
15 .new_node(
16 taffy::style::Style {
17 size: taffy::geometry::Size { height: taffy::style::Dimension::Points(100f32), ..Default::default() },
18 ..Default::default()
19 },
20 &[],
21 )
22 .unwrap();
23 let node0 = taffy
24 .new_node(
25 taffy::style::Style {
26 flex_direction: taffy::style::FlexDirection::Column,
27 flex_grow: 1f32,
28 min_size: taffy::geometry::Size {
29 height: taffy::style::Dimension::Points(100f32),
30 ..Default::default()
31 },
32 max_size: taffy::geometry::Size {
33 height: taffy::style::Dimension::Points(500f32),
34 ..Default::default()
35 },
36 ..Default::default()
37 },
38 &[node00, node01],
39 )
40 .unwrap();
41 let node = taffy
42 .new_node(
43 taffy::style::Style {
44 flex_direction: taffy::style::FlexDirection::Column,
45 size: taffy::geometry::Size {
46 width: taffy::style::Dimension::Points(100f32),
47 height: taffy::style::Dimension::Points(500f32),
48 ..Default::default()
49 },
50 ..Default::default()
51 },
52 &[node0],
53 )
54 .unwrap();
55 taffy.compute_layout(node, taffy::geometry::Size::undefined()).unwrap();
56 assert_eq!(taffy.layout(node).unwrap().size.width, 100f32);
57 assert_eq!(taffy.layout(node).unwrap().size.height, 500f32);
58 assert_eq!(taffy.layout(node).unwrap().location.x, 0f32);
59 assert_eq!(taffy.layout(node).unwrap().location.y, 0f32);
60 assert_eq!(taffy.layout(node0).unwrap().size.width, 100f32);
61 assert_eq!(taffy.layout(node0).unwrap().size.height, 500f32);
62 assert_eq!(taffy.layout(node0).unwrap().location.x, 0f32);
63 assert_eq!(taffy.layout(node0).unwrap().location.y, 0f32);
64 assert_eq!(taffy.layout(node00).unwrap().size.width, 100f32);
65 assert_eq!(taffy.layout(node00).unwrap().size.height, 400f32);
66 assert_eq!(taffy.layout(node00).unwrap().location.x, 0f32);
67 assert_eq!(taffy.layout(node00).unwrap().location.y, 0f32);
68 assert_eq!(taffy.layout(node01).unwrap().size.width, 100f32);
69 assert_eq!(taffy.layout(node01).unwrap().size.height, 100f32);
70 assert_eq!(taffy.layout(node01).unwrap().location.x, 0f32);
71 assert_eq!(taffy.layout(node01).unwrap().location.y, 400f32);
72}