⎇ bce89b1006f36ce35abfaf1f1c2b3dd95f3dffd3
tests/generated/wrap_nodes_with_content_sizing_overflowing_margin.rs
Historia
Quién tocó qué
crudo
index: update tests to API changes
1#[test]
2fn wrap_nodes_with_content_sizing_overflowing_margin() {
3 let mut stretch = stretch::Stretch::new();
4 let node000 = stretch
5 .new_node(
6 stretch::style::Style {
7 size: stretch::geometry::Size {
8 width: stretch::style::Dimension::Points(40f32),
9 height: stretch::style::Dimension::Points(40f32),
10 ..Default::default()
11 },
12 ..Default::default()
13 },
14 vec![],
15 )
16 .unwrap();
17 let node00 = stretch
18 .new_node(
19 stretch::style::Style { flex_direction: stretch::style::FlexDirection::Column, ..Default::default() },
20 vec![node000],
21 )
22 .unwrap();
23 let node010 = stretch
24 .new_node(
25 stretch::style::Style {
26 size: stretch::geometry::Size {
27 width: stretch::style::Dimension::Points(40f32),
28 height: stretch::style::Dimension::Points(40f32),
29 ..Default::default()
30 },
31 ..Default::default()
32 },
33 vec![],
34 )
35 .unwrap();
36 let node01 = stretch
37 .new_node(
38 stretch::style::Style {
39 flex_direction: stretch::style::FlexDirection::Column,
40 margin: stretch::geometry::Rect { end: stretch::style::Dimension::Points(10f32), ..Default::default() },
41 ..Default::default()
42 },
43 vec![node010],
44 )
45 .unwrap();
46 let node0 = stretch
47 .new_node(
48 stretch::style::Style {
49 flex_wrap: stretch::style::FlexWrap::Wrap,
50 size: stretch::geometry::Size { width: stretch::style::Dimension::Points(85f32), ..Default::default() },
51 ..Default::default()
52 },
53 vec![node00, node01],
54 )
55 .unwrap();
56 let node = stretch
57 .new_node(
58 stretch::style::Style {
59 flex_direction: stretch::style::FlexDirection::Column,
60 size: stretch::geometry::Size {
61 width: stretch::style::Dimension::Points(500f32),
62 height: stretch::style::Dimension::Points(500f32),
63 ..Default::default()
64 },
65 ..Default::default()
66 },
67 vec![node0],
68 )
69 .unwrap();
70 stretch.compute_layout(node, stretch::geometry::Size::undefined()).unwrap();
71 assert_eq!(stretch.layout(node).unwrap().size.width, 500f32);
72 assert_eq!(stretch.layout(node).unwrap().size.height, 500f32);
73 assert_eq!(stretch.layout(node).unwrap().location.x, 0f32);
74 assert_eq!(stretch.layout(node).unwrap().location.y, 0f32);
75 assert_eq!(stretch.layout(node0).unwrap().size.width, 85f32);
76 assert_eq!(stretch.layout(node0).unwrap().size.height, 80f32);
77 assert_eq!(stretch.layout(node0).unwrap().location.x, 0f32);
78 assert_eq!(stretch.layout(node0).unwrap().location.y, 0f32);
79 assert_eq!(stretch.layout(node00).unwrap().size.width, 40f32);
80 assert_eq!(stretch.layout(node00).unwrap().size.height, 40f32);
81 assert_eq!(stretch.layout(node00).unwrap().location.x, 0f32);
82 assert_eq!(stretch.layout(node00).unwrap().location.y, 0f32);
83 assert_eq!(stretch.layout(node000).unwrap().size.width, 40f32);
84 assert_eq!(stretch.layout(node000).unwrap().size.height, 40f32);
85 assert_eq!(stretch.layout(node000).unwrap().location.x, 0f32);
86 assert_eq!(stretch.layout(node000).unwrap().location.y, 0f32);
87 assert_eq!(stretch.layout(node01).unwrap().size.width, 40f32);
88 assert_eq!(stretch.layout(node01).unwrap().size.height, 40f32);
89 assert_eq!(stretch.layout(node01).unwrap().location.x, 0f32);
90 assert_eq!(stretch.layout(node01).unwrap().location.y, 40f32);
91 assert_eq!(stretch.layout(node010).unwrap().size.width, 40f32);
92 assert_eq!(stretch.layout(node010).unwrap().size.height, 40f32);
93 assert_eq!(stretch.layout(node010).unwrap().location.x, 0f32);
94 assert_eq!(stretch.layout(node010).unwrap().location.y, 0f32);
95}