⎇ a1e91740880b61f1c39c9114b628ff09655141a9
tests/generated/wrap_reverse_row_align_content_space_around.rs
Historia
Quién tocó qué
crudo
1#[test]
2fn wrap_reverse_row_align_content_space_around() {
3 let mut sprawl = sprawl::Sprawl::new();
4 let node0 = sprawl
5 .new_node(
6 sprawl::style::Style {
7 size: sprawl::geometry::Size {
8 width: sprawl::style::Dimension::Points(30f32),
9 height: sprawl::style::Dimension::Points(10f32),
10 ..Default::default()
11 },
12 ..Default::default()
13 },
14 &[],
15 )
16 .unwrap();
17 let node1 = sprawl
18 .new_node(
19 sprawl::style::Style {
20 size: sprawl::geometry::Size {
21 width: sprawl::style::Dimension::Points(30f32),
22 height: sprawl::style::Dimension::Points(20f32),
23 ..Default::default()
24 },
25 ..Default::default()
26 },
27 &[],
28 )
29 .unwrap();
30 let node2 = sprawl
31 .new_node(
32 sprawl::style::Style {
33 size: sprawl::geometry::Size {
34 width: sprawl::style::Dimension::Points(30f32),
35 height: sprawl::style::Dimension::Points(30f32),
36 ..Default::default()
37 },
38 ..Default::default()
39 },
40 &[],
41 )
42 .unwrap();
43 let node3 = sprawl
44 .new_node(
45 sprawl::style::Style {
46 size: sprawl::geometry::Size {
47 width: sprawl::style::Dimension::Points(30f32),
48 height: sprawl::style::Dimension::Points(40f32),
49 ..Default::default()
50 },
51 ..Default::default()
52 },
53 &[],
54 )
55 .unwrap();
56 let node4 = sprawl
57 .new_node(
58 sprawl::style::Style {
59 size: sprawl::geometry::Size {
60 width: sprawl::style::Dimension::Points(30f32),
61 height: sprawl::style::Dimension::Points(50f32),
62 ..Default::default()
63 },
64 ..Default::default()
65 },
66 &[],
67 )
68 .unwrap();
69 let node = sprawl
70 .new_node(
71 sprawl::style::Style {
72 flex_wrap: sprawl::style::FlexWrap::WrapReverse,
73 align_content: sprawl::style::AlignContent::SpaceAround,
74 size: sprawl::geometry::Size { width: sprawl::style::Dimension::Points(100f32), ..Default::default() },
75 ..Default::default()
76 },
77 &[node0, node1, node2, node3, node4],
78 )
79 .unwrap();
80 sprawl.compute_layout(node, sprawl::geometry::Size::undefined()).unwrap();
81 assert_eq!(sprawl.layout(node).unwrap().size.width, 100f32);
82 assert_eq!(sprawl.layout(node).unwrap().size.height, 80f32);
83 assert_eq!(sprawl.layout(node).unwrap().location.x, 0f32);
84 assert_eq!(sprawl.layout(node).unwrap().location.y, 0f32);
85 assert_eq!(sprawl.layout(node0).unwrap().size.width, 30f32);
86 assert_eq!(sprawl.layout(node0).unwrap().size.height, 10f32);
87 assert_eq!(sprawl.layout(node0).unwrap().location.x, 0f32);
88 assert_eq!(sprawl.layout(node0).unwrap().location.y, 70f32);
89 assert_eq!(sprawl.layout(node1).unwrap().size.width, 30f32);
90 assert_eq!(sprawl.layout(node1).unwrap().size.height, 20f32);
91 assert_eq!(sprawl.layout(node1).unwrap().location.x, 30f32);
92 assert_eq!(sprawl.layout(node1).unwrap().location.y, 60f32);
93 assert_eq!(sprawl.layout(node2).unwrap().size.width, 30f32);
94 assert_eq!(sprawl.layout(node2).unwrap().size.height, 30f32);
95 assert_eq!(sprawl.layout(node2).unwrap().location.x, 60f32);
96 assert_eq!(sprawl.layout(node2).unwrap().location.y, 50f32);
97 assert_eq!(sprawl.layout(node3).unwrap().size.width, 30f32);
98 assert_eq!(sprawl.layout(node3).unwrap().size.height, 40f32);
99 assert_eq!(sprawl.layout(node3).unwrap().location.x, 0f32);
100 assert_eq!(sprawl.layout(node3).unwrap().location.y, 10f32);
101 assert_eq!(sprawl.layout(node4).unwrap().size.width, 30f32);
102 assert_eq!(sprawl.layout(node4).unwrap().size.height, 50f32);
103 assert_eq!(sprawl.layout(node4).unwrap().location.x, 30f32);
104 assert_eq!(sprawl.layout(node4).unwrap().location.y, 0f32);
105}