⎇ 0.2.x
tests/generated/gap_column_gap_wrap_align_space_between.rs
Ñawpa willay
Pi imata llamkarqan
ch'uya
Rename FlexboxLayout back to Style (#251)
1#[test]
2fn gap_column_gap_wrap_align_space_between() {
3 let mut taffy = taffy::Taffy::new();
4 let node0 = taffy
5 .new_with_children(
6 taffy::style::Style {
7 size: taffy::geometry::Size {
8 width: taffy::style::Dimension::Points(20f32),
9 height: taffy::style::Dimension::Points(20f32),
10 ..Default::default()
11 },
12 ..Default::default()
13 },
14 &[],
15 )
16 .unwrap();
17 let node1 = taffy
18 .new_with_children(
19 taffy::style::Style {
20 size: taffy::geometry::Size {
21 width: taffy::style::Dimension::Points(20f32),
22 height: taffy::style::Dimension::Points(20f32),
23 ..Default::default()
24 },
25 ..Default::default()
26 },
27 &[],
28 )
29 .unwrap();
30 let node2 = taffy
31 .new_with_children(
32 taffy::style::Style {
33 size: taffy::geometry::Size {
34 width: taffy::style::Dimension::Points(20f32),
35 height: taffy::style::Dimension::Points(20f32),
36 ..Default::default()
37 },
38 ..Default::default()
39 },
40 &[],
41 )
42 .unwrap();
43 let node3 = taffy
44 .new_with_children(
45 taffy::style::Style {
46 size: taffy::geometry::Size {
47 width: taffy::style::Dimension::Points(20f32),
48 height: taffy::style::Dimension::Points(20f32),
49 ..Default::default()
50 },
51 ..Default::default()
52 },
53 &[],
54 )
55 .unwrap();
56 let node4 = taffy
57 .new_with_children(
58 taffy::style::Style {
59 size: taffy::geometry::Size {
60 width: taffy::style::Dimension::Points(20f32),
61 height: taffy::style::Dimension::Points(20f32),
62 ..Default::default()
63 },
64 ..Default::default()
65 },
66 &[],
67 )
68 .unwrap();
69 let node5 = taffy
70 .new_with_children(
71 taffy::style::Style {
72 size: taffy::geometry::Size {
73 width: taffy::style::Dimension::Points(20f32),
74 height: taffy::style::Dimension::Points(20f32),
75 ..Default::default()
76 },
77 ..Default::default()
78 },
79 &[],
80 )
81 .unwrap();
82 let node = taffy
83 .new_with_children(
84 taffy::style::Style {
85 flex_wrap: taffy::style::FlexWrap::Wrap,
86 align_content: taffy::style::AlignContent::SpaceBetween,
87 gap: taffy::geometry::Size {
88 width: taffy::style::Dimension::Points(10f32),
89 height: taffy::style::Dimension::Points(20f32),
90 ..Default::default()
91 },
92 size: taffy::geometry::Size {
93 width: taffy::style::Dimension::Points(100f32),
94 height: taffy::style::Dimension::Points(100f32),
95 ..Default::default()
96 },
97 ..Default::default()
98 },
99 &[node0, node1, node2, node3, node4, node5],
100 )
101 .unwrap();
102 taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
103 assert_eq!(taffy.layout(node).unwrap().size.width, 100f32);
104 assert_eq!(taffy.layout(node).unwrap().size.height, 100f32);
105 assert_eq!(taffy.layout(node).unwrap().location.x, 0f32);
106 assert_eq!(taffy.layout(node).unwrap().location.y, 0f32);
107 assert_eq!(taffy.layout(node0).unwrap().size.width, 20f32);
108 assert_eq!(taffy.layout(node0).unwrap().size.height, 20f32);
109 assert_eq!(taffy.layout(node0).unwrap().location.x, 0f32);
110 assert_eq!(taffy.layout(node0).unwrap().location.y, 0f32);
111 assert_eq!(taffy.layout(node1).unwrap().size.width, 20f32);
112 assert_eq!(taffy.layout(node1).unwrap().size.height, 20f32);
113 assert_eq!(taffy.layout(node1).unwrap().location.x, 30f32);
114 assert_eq!(taffy.layout(node1).unwrap().location.y, 0f32);
115 assert_eq!(taffy.layout(node2).unwrap().size.width, 20f32);
116 assert_eq!(taffy.layout(node2).unwrap().size.height, 20f32);
117 assert_eq!(taffy.layout(node2).unwrap().location.x, 60f32);
118 assert_eq!(taffy.layout(node2).unwrap().location.y, 0f32);
119 assert_eq!(taffy.layout(node3).unwrap().size.width, 20f32);
120 assert_eq!(taffy.layout(node3).unwrap().size.height, 20f32);
121 assert_eq!(taffy.layout(node3).unwrap().location.x, 0f32);
122 assert_eq!(taffy.layout(node3).unwrap().location.y, 80f32);
123 assert_eq!(taffy.layout(node4).unwrap().size.width, 20f32);
124 assert_eq!(taffy.layout(node4).unwrap().size.height, 20f32);
125 assert_eq!(taffy.layout(node4).unwrap().location.x, 30f32);
126 assert_eq!(taffy.layout(node4).unwrap().location.y, 80f32);
127 assert_eq!(taffy.layout(node5).unwrap().size.width, 20f32);
128 assert_eq!(taffy.layout(node5).unwrap().size.height, 20f32);
129 assert_eq!(taffy.layout(node5).unwrap().location.x, 60f32);
130 assert_eq!(taffy.layout(node5).unwrap().location.y, 80f32);
131}