⎇ 0.2.x
tests/generated/gap_column_gap_wrap_align_stretch.rs
Ñawpa willay
Pi imata llamkarqan
ch'uya
Rename FlexboxLayout back to Style (#251)
1#[test]
2fn gap_column_gap_wrap_align_stretch() {
3 let mut taffy = taffy::Taffy::new();
4 let node0 = taffy
5 .new_with_children(
6 taffy::style::Style {
7 flex_grow: 1f32,
8 min_size: taffy::geometry::Size { width: taffy::style::Dimension::Points(60f32), ..Default::default() },
9 ..Default::default()
10 },
11 &[],
12 )
13 .unwrap();
14 let node1 = taffy
15 .new_with_children(
16 taffy::style::Style {
17 flex_grow: 1f32,
18 min_size: taffy::geometry::Size { width: taffy::style::Dimension::Points(60f32), ..Default::default() },
19 ..Default::default()
20 },
21 &[],
22 )
23 .unwrap();
24 let node2 = taffy
25 .new_with_children(
26 taffy::style::Style {
27 flex_grow: 1f32,
28 min_size: taffy::geometry::Size { width: taffy::style::Dimension::Points(60f32), ..Default::default() },
29 ..Default::default()
30 },
31 &[],
32 )
33 .unwrap();
34 let node3 = taffy
35 .new_with_children(
36 taffy::style::Style {
37 flex_grow: 1f32,
38 min_size: taffy::geometry::Size { width: taffy::style::Dimension::Points(60f32), ..Default::default() },
39 ..Default::default()
40 },
41 &[],
42 )
43 .unwrap();
44 let node4 = taffy
45 .new_with_children(
46 taffy::style::Style {
47 flex_grow: 1f32,
48 min_size: taffy::geometry::Size { width: taffy::style::Dimension::Points(60f32), ..Default::default() },
49 ..Default::default()
50 },
51 &[],
52 )
53 .unwrap();
54 let node = taffy
55 .new_with_children(
56 taffy::style::Style {
57 flex_wrap: taffy::style::FlexWrap::Wrap,
58 gap: taffy::geometry::Size { width: taffy::style::Dimension::Points(5f32), ..Default::default() },
59 size: taffy::geometry::Size {
60 width: taffy::style::Dimension::Points(300f32),
61 height: taffy::style::Dimension::Points(300f32),
62 ..Default::default()
63 },
64 ..Default::default()
65 },
66 &[node0, node1, node2, node3, node4],
67 )
68 .unwrap();
69 taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
70 assert_eq!(taffy.layout(node).unwrap().size.width, 300f32);
71 assert_eq!(taffy.layout(node).unwrap().size.height, 300f32);
72 assert_eq!(taffy.layout(node).unwrap().location.x, 0f32);
73 assert_eq!(taffy.layout(node).unwrap().location.y, 0f32);
74 assert_eq!(taffy.layout(node0).unwrap().size.width, 71f32);
75 assert_eq!(taffy.layout(node0).unwrap().size.height, 150f32);
76 assert_eq!(taffy.layout(node0).unwrap().location.x, 0f32);
77 assert_eq!(taffy.layout(node0).unwrap().location.y, 0f32);
78 assert_eq!(taffy.layout(node1).unwrap().size.width, 71f32);
79 assert_eq!(taffy.layout(node1).unwrap().size.height, 150f32);
80 assert_eq!(taffy.layout(node1).unwrap().location.x, 76f32);
81 assert_eq!(taffy.layout(node1).unwrap().location.y, 0f32);
82 assert_eq!(taffy.layout(node2).unwrap().size.width, 71f32);
83 assert_eq!(taffy.layout(node2).unwrap().size.height, 150f32);
84 assert_eq!(taffy.layout(node2).unwrap().location.x, 153f32);
85 assert_eq!(taffy.layout(node2).unwrap().location.y, 0f32);
86 assert_eq!(taffy.layout(node3).unwrap().size.width, 71f32);
87 assert_eq!(taffy.layout(node3).unwrap().size.height, 150f32);
88 assert_eq!(taffy.layout(node3).unwrap().location.x, 229f32);
89 assert_eq!(taffy.layout(node3).unwrap().location.y, 0f32);
90 assert_eq!(taffy.layout(node4).unwrap().size.width, 300f32);
91 assert_eq!(taffy.layout(node4).unwrap().size.height, 150f32);
92 assert_eq!(taffy.layout(node4).unwrap().location.x, 0f32);
93 assert_eq!(taffy.layout(node4).unwrap().location.y, 150f32);
94}