⎇ 39cd0fcbbda7cd38cc6316e7339b1f3aed29e99f
tests/generated/wrapped_column_max_height_flex.rs
Ñawpa willay
Pi imata llamkarqan
ch'uya
Rename `new_node` to `new_with_children` (#142)
1#[test]
2fn wrapped_column_max_height_flex() {
3 let mut taffy = taffy::Taffy::new();
4 let node0 = taffy
5 .new_with_children(
6 taffy::style::FlexboxLayout {
7 flex_grow: 1f32,
8 flex_shrink: 1f32,
9 flex_basis: taffy::style::Dimension::Percent(0f32),
10 size: taffy::geometry::Size {
11 width: taffy::style::Dimension::Points(100f32),
12 height: taffy::style::Dimension::Points(500f32),
13 ..Default::default()
14 },
15 max_size: taffy::geometry::Size {
16 height: taffy::style::Dimension::Points(200f32),
17 ..Default::default()
18 },
19 ..Default::default()
20 },
21 &[],
22 )
23 .unwrap();
24 let node1 = taffy
25 .new_with_children(
26 taffy::style::FlexboxLayout {
27 flex_grow: 1f32,
28 flex_shrink: 1f32,
29 flex_basis: taffy::style::Dimension::Percent(0f32),
30 size: taffy::geometry::Size {
31 width: taffy::style::Dimension::Points(200f32),
32 height: taffy::style::Dimension::Points(200f32),
33 ..Default::default()
34 },
35 margin: taffy::geometry::Rect {
36 start: taffy::style::Dimension::Points(20f32),
37 end: taffy::style::Dimension::Points(20f32),
38 top: taffy::style::Dimension::Points(20f32),
39 bottom: taffy::style::Dimension::Points(20f32),
40 ..Default::default()
41 },
42 ..Default::default()
43 },
44 &[],
45 )
46 .unwrap();
47 let node2 = taffy
48 .new_with_children(
49 taffy::style::FlexboxLayout {
50 size: taffy::geometry::Size {
51 width: taffy::style::Dimension::Points(100f32),
52 height: taffy::style::Dimension::Points(100f32),
53 ..Default::default()
54 },
55 ..Default::default()
56 },
57 &[],
58 )
59 .unwrap();
60 let node = taffy
61 .new_with_children(
62 taffy::style::FlexboxLayout {
63 flex_direction: taffy::style::FlexDirection::Column,
64 flex_wrap: taffy::style::FlexWrap::Wrap,
65 align_items: taffy::style::AlignItems::Center,
66 align_content: taffy::style::AlignContent::Center,
67 justify_content: taffy::style::JustifyContent::Center,
68 size: taffy::geometry::Size {
69 width: taffy::style::Dimension::Points(700f32),
70 height: taffy::style::Dimension::Points(500f32),
71 ..Default::default()
72 },
73 ..Default::default()
74 },
75 &[node0, node1, node2],
76 )
77 .unwrap();
78 taffy.compute_layout(node, taffy::geometry::Size::undefined()).unwrap();
79 assert_eq!(taffy.layout(node).unwrap().size.width, 700f32);
80 assert_eq!(taffy.layout(node).unwrap().size.height, 500f32);
81 assert_eq!(taffy.layout(node).unwrap().location.x, 0f32);
82 assert_eq!(taffy.layout(node).unwrap().location.y, 0f32);
83 assert_eq!(taffy.layout(node0).unwrap().size.width, 100f32);
84 assert_eq!(taffy.layout(node0).unwrap().size.height, 180f32);
85 assert_eq!(taffy.layout(node0).unwrap().location.x, 300f32);
86 assert_eq!(taffy.layout(node0).unwrap().location.y, 0f32);
87 assert_eq!(taffy.layout(node1).unwrap().size.width, 200f32);
88 assert_eq!(taffy.layout(node1).unwrap().size.height, 180f32);
89 assert_eq!(taffy.layout(node1).unwrap().location.x, 250f32);
90 assert_eq!(taffy.layout(node1).unwrap().location.y, 200f32);
91 assert_eq!(taffy.layout(node2).unwrap().size.width, 100f32);
92 assert_eq!(taffy.layout(node2).unwrap().size.height, 100f32);
93 assert_eq!(taffy.layout(node2).unwrap().location.x, 300f32);
94 assert_eq!(taffy.layout(node2).unwrap().location.y, 400f32);
95}