⎇ bce89b1006f36ce35abfaf1f1c2b3dd95f3dffd3
tests/generated/rounding_fractial_input_1.rs
Historia
Quién tocó qué
crudo
index: update tests to API changes
1#[test]
2fn rounding_fractial_input_1() {
3 let mut stretch = stretch::Stretch::new();
4 let node0 = stretch
5 .new_node(
6 stretch::style::Style {
7 flex_grow: 1f32,
8 flex_basis: stretch::style::Dimension::Points(50f32),
9 size: stretch::geometry::Size {
10 height: stretch::style::Dimension::Points(20f32),
11 ..Default::default()
12 },
13 ..Default::default()
14 },
15 vec![],
16 )
17 .unwrap();
18 let node1 = stretch
19 .new_node(
20 stretch::style::Style {
21 flex_grow: 1f32,
22 size: stretch::geometry::Size {
23 height: stretch::style::Dimension::Points(10f32),
24 ..Default::default()
25 },
26 ..Default::default()
27 },
28 vec![],
29 )
30 .unwrap();
31 let node2 = stretch
32 .new_node(
33 stretch::style::Style {
34 flex_grow: 1f32,
35 size: stretch::geometry::Size {
36 height: stretch::style::Dimension::Points(10f32),
37 ..Default::default()
38 },
39 ..Default::default()
40 },
41 vec![],
42 )
43 .unwrap();
44 let node = stretch
45 .new_node(
46 stretch::style::Style {
47 flex_direction: stretch::style::FlexDirection::Column,
48 size: stretch::geometry::Size {
49 width: stretch::style::Dimension::Points(100f32),
50 height: stretch::style::Dimension::Points(113.4f32),
51 ..Default::default()
52 },
53 ..Default::default()
54 },
55 vec![node0, node1, node2],
56 )
57 .unwrap();
58 stretch.compute_layout(node, stretch::geometry::Size::undefined()).unwrap();
59 assert_eq!(stretch.layout(node).unwrap().size.width, 100f32);
60 assert_eq!(stretch.layout(node).unwrap().size.height, 113f32);
61 assert_eq!(stretch.layout(node).unwrap().location.x, 0f32);
62 assert_eq!(stretch.layout(node).unwrap().location.y, 0f32);
63 assert_eq!(stretch.layout(node0).unwrap().size.width, 100f32);
64 assert_eq!(stretch.layout(node0).unwrap().size.height, 64f32);
65 assert_eq!(stretch.layout(node0).unwrap().location.x, 0f32);
66 assert_eq!(stretch.layout(node0).unwrap().location.y, 0f32);
67 assert_eq!(stretch.layout(node1).unwrap().size.width, 100f32);
68 assert_eq!(stretch.layout(node1).unwrap().size.height, 25f32);
69 assert_eq!(stretch.layout(node1).unwrap().location.x, 0f32);
70 assert_eq!(stretch.layout(node1).unwrap().location.y, 64f32);
71 assert_eq!(stretch.layout(node2).unwrap().size.width, 100f32);
72 assert_eq!(stretch.layout(node2).unwrap().size.height, 24f32);
73 assert_eq!(stretch.layout(node2).unwrap().location.x, 0f32);
74 assert_eq!(stretch.layout(node2).unwrap().location.y, 89f32);
75}