⎇ 6e9ad8ea330ed91c1fbe3169f972ccebd374f85e
tests/generated/wrap_reverse_column_fixed_size.rs
Ñawpa willay
Pi imata llamkarqan
ch'uya
index: update tests to API changes
1#[test]
2fn wrap_reverse_column_fixed_size() {
3 let mut stretch = stretch::Stretch::new();
4 let node0 = stretch
5 .new_node(
6 stretch::style::Style {
7 size: stretch::geometry::Size {
8 width: stretch::style::Dimension::Points(30f32),
9 height: stretch::style::Dimension::Points(10f32),
10 ..Default::default()
11 },
12 ..Default::default()
13 },
14 vec![],
15 )
16 .unwrap();
17 let node1 = stretch
18 .new_node(
19 stretch::style::Style {
20 size: stretch::geometry::Size {
21 width: stretch::style::Dimension::Points(30f32),
22 height: stretch::style::Dimension::Points(20f32),
23 ..Default::default()
24 },
25 ..Default::default()
26 },
27 vec![],
28 )
29 .unwrap();
30 let node2 = stretch
31 .new_node(
32 stretch::style::Style {
33 size: stretch::geometry::Size {
34 width: stretch::style::Dimension::Points(30f32),
35 height: stretch::style::Dimension::Points(30f32),
36 ..Default::default()
37 },
38 ..Default::default()
39 },
40 vec![],
41 )
42 .unwrap();
43 let node3 = stretch
44 .new_node(
45 stretch::style::Style {
46 size: stretch::geometry::Size {
47 width: stretch::style::Dimension::Points(30f32),
48 height: stretch::style::Dimension::Points(40f32),
49 ..Default::default()
50 },
51 ..Default::default()
52 },
53 vec![],
54 )
55 .unwrap();
56 let node4 = stretch
57 .new_node(
58 stretch::style::Style {
59 size: stretch::geometry::Size {
60 width: stretch::style::Dimension::Points(30f32),
61 height: stretch::style::Dimension::Points(50f32),
62 ..Default::default()
63 },
64 ..Default::default()
65 },
66 vec![],
67 )
68 .unwrap();
69 let node = stretch
70 .new_node(
71 stretch::style::Style {
72 flex_direction: stretch::style::FlexDirection::Column,
73 flex_wrap: stretch::style::FlexWrap::WrapReverse,
74 align_items: stretch::style::AlignItems::Center,
75 size: stretch::geometry::Size {
76 width: stretch::style::Dimension::Points(200f32),
77 height: stretch::style::Dimension::Points(100f32),
78 ..Default::default()
79 },
80 ..Default::default()
81 },
82 vec![node0, node1, node2, node3, node4],
83 )
84 .unwrap();
85 stretch.compute_layout(node, stretch::geometry::Size::undefined()).unwrap();
86 assert_eq!(stretch.layout(node).unwrap().size.width, 200f32);
87 assert_eq!(stretch.layout(node).unwrap().size.height, 100f32);
88 assert_eq!(stretch.layout(node).unwrap().location.x, 0f32);
89 assert_eq!(stretch.layout(node).unwrap().location.y, 0f32);
90 assert_eq!(stretch.layout(node0).unwrap().size.width, 30f32);
91 assert_eq!(stretch.layout(node0).unwrap().size.height, 10f32);
92 assert_eq!(stretch.layout(node0).unwrap().location.x, 135f32);
93 assert_eq!(stretch.layout(node0).unwrap().location.y, 0f32);
94 assert_eq!(stretch.layout(node1).unwrap().size.width, 30f32);
95 assert_eq!(stretch.layout(node1).unwrap().size.height, 20f32);
96 assert_eq!(stretch.layout(node1).unwrap().location.x, 135f32);
97 assert_eq!(stretch.layout(node1).unwrap().location.y, 10f32);
98 assert_eq!(stretch.layout(node2).unwrap().size.width, 30f32);
99 assert_eq!(stretch.layout(node2).unwrap().size.height, 30f32);
100 assert_eq!(stretch.layout(node2).unwrap().location.x, 135f32);
101 assert_eq!(stretch.layout(node2).unwrap().location.y, 30f32);
102 assert_eq!(stretch.layout(node3).unwrap().size.width, 30f32);
103 assert_eq!(stretch.layout(node3).unwrap().size.height, 40f32);
104 assert_eq!(stretch.layout(node3).unwrap().location.x, 135f32);
105 assert_eq!(stretch.layout(node3).unwrap().location.y, 60f32);
106 assert_eq!(stretch.layout(node4).unwrap().size.width, 30f32);
107 assert_eq!(stretch.layout(node4).unwrap().size.height, 50f32);
108 assert_eq!(stretch.layout(node4).unwrap().location.x, 35f32);
109 assert_eq!(stretch.layout(node4).unwrap().location.y, 0f32);
110}