⎇ a149c6b6b8f7d25328e78ba649b76d1841c55d9d
tests/generated/rounding_total_fractial_nested.rs
History
Who touched what
raw
index: update tests to API changes
1#[test]
2fn rounding_total_fractial_nested() {
3 let mut stretch = stretch::Stretch::new();
4 let node00 = stretch
5 .new_node(
6 stretch::style::Style {
7 flex_grow: 1f32,
8 flex_basis: stretch::style::Dimension::Points(0.3f32),
9 size: stretch::geometry::Size {
10 height: stretch::style::Dimension::Points(9.9f32),
11 ..Default::default()
12 },
13 position: stretch::geometry::Rect {
14 bottom: stretch::style::Dimension::Points(13.3f32),
15 ..Default::default()
16 },
17 ..Default::default()
18 },
19 vec![],
20 )
21 .unwrap();
22 let node01 = stretch
23 .new_node(
24 stretch::style::Style {
25 flex_grow: 4f32,
26 flex_basis: stretch::style::Dimension::Points(0.3f32),
27 size: stretch::geometry::Size {
28 height: stretch::style::Dimension::Points(1.1f32),
29 ..Default::default()
30 },
31 position: stretch::geometry::Rect {
32 top: stretch::style::Dimension::Points(13.3f32),
33 ..Default::default()
34 },
35 ..Default::default()
36 },
37 vec![],
38 )
39 .unwrap();
40 let node0 = stretch
41 .new_node(
42 stretch::style::Style {
43 flex_direction: stretch::style::FlexDirection::Column,
44 flex_grow: 0.7f32,
45 flex_basis: stretch::style::Dimension::Points(50.3f32),
46 size: stretch::geometry::Size {
47 height: stretch::style::Dimension::Points(20.3f32),
48 ..Default::default()
49 },
50 ..Default::default()
51 },
52 vec![node00, node01],
53 )
54 .unwrap();
55 let node1 = stretch
56 .new_node(
57 stretch::style::Style {
58 flex_grow: 1.6f32,
59 size: stretch::geometry::Size {
60 height: stretch::style::Dimension::Points(10f32),
61 ..Default::default()
62 },
63 ..Default::default()
64 },
65 vec![],
66 )
67 .unwrap();
68 let node2 = stretch
69 .new_node(
70 stretch::style::Style {
71 flex_grow: 1.1f32,
72 size: stretch::geometry::Size {
73 height: stretch::style::Dimension::Points(10.7f32),
74 ..Default::default()
75 },
76 ..Default::default()
77 },
78 vec![],
79 )
80 .unwrap();
81 let node = stretch
82 .new_node(
83 stretch::style::Style {
84 flex_direction: stretch::style::FlexDirection::Column,
85 size: stretch::geometry::Size {
86 width: stretch::style::Dimension::Points(87.4f32),
87 height: stretch::style::Dimension::Points(113.4f32),
88 ..Default::default()
89 },
90 ..Default::default()
91 },
92 vec![node0, node1, node2],
93 )
94 .unwrap();
95 stretch.compute_layout(node, stretch::geometry::Size::undefined()).unwrap();
96 assert_eq!(stretch.layout(node).unwrap().size.width, 87f32);
97 assert_eq!(stretch.layout(node).unwrap().size.height, 113f32);
98 assert_eq!(stretch.layout(node).unwrap().location.x, 0f32);
99 assert_eq!(stretch.layout(node).unwrap().location.y, 0f32);
100 assert_eq!(stretch.layout(node0).unwrap().size.width, 87f32);
101 assert_eq!(stretch.layout(node0).unwrap().size.height, 59f32);
102 assert_eq!(stretch.layout(node0).unwrap().location.x, 0f32);
103 assert_eq!(stretch.layout(node0).unwrap().location.y, 0f32);
104 assert_eq!(stretch.layout(node00).unwrap().size.width, 87f32);
105 assert_eq!(stretch.layout(node00).unwrap().size.height, 12f32);
106 assert_eq!(stretch.layout(node00).unwrap().location.x, 0f32);
107 assert_eq!(stretch.layout(node00).unwrap().location.y, -13f32);
108 assert_eq!(stretch.layout(node01).unwrap().size.width, 87f32);
109 assert_eq!(stretch.layout(node01).unwrap().size.height, 47f32);
110 assert_eq!(stretch.layout(node01).unwrap().location.x, 0f32);
111 assert_eq!(stretch.layout(node01).unwrap().location.y, 25f32);
112 assert_eq!(stretch.layout(node1).unwrap().size.width, 87f32);
113 assert_eq!(stretch.layout(node1).unwrap().size.height, 30f32);
114 assert_eq!(stretch.layout(node1).unwrap().location.x, 0f32);
115 assert_eq!(stretch.layout(node1).unwrap().location.y, 59f32);
116 assert_eq!(stretch.layout(node2).unwrap().size.width, 87f32);
117 assert_eq!(stretch.layout(node2).unwrap().size.height, 24f32);
118 assert_eq!(stretch.layout(node2).unwrap().location.x, 0f32);
119 assert_eq!(stretch.layout(node2).unwrap().location.y, 89f32);
120}