⎇ bce89b1006f36ce35abfaf1f1c2b3dd95f3dffd3
tests/generated/flex_grow_root_minimized.rs
Historia
Quién tocó qué
crudo
index: update tests to API changes
1#[test]
2fn flex_grow_root_minimized() {
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(200f32),
9 ..Default::default()
10 },
11 vec![],
12 )
13 .unwrap();
14 let node01 = stretch
15 .new_node(
16 stretch::style::Style {
17 size: stretch::geometry::Size {
18 height: stretch::style::Dimension::Points(100f32),
19 ..Default::default()
20 },
21 ..Default::default()
22 },
23 vec![],
24 )
25 .unwrap();
26 let node0 = stretch
27 .new_node(
28 stretch::style::Style {
29 flex_direction: stretch::style::FlexDirection::Column,
30 flex_grow: 1f32,
31 min_size: stretch::geometry::Size {
32 height: stretch::style::Dimension::Points(100f32),
33 ..Default::default()
34 },
35 max_size: stretch::geometry::Size {
36 height: stretch::style::Dimension::Points(500f32),
37 ..Default::default()
38 },
39 ..Default::default()
40 },
41 vec![node00, node01],
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 ..Default::default()
51 },
52 min_size: stretch::geometry::Size {
53 height: stretch::style::Dimension::Points(100f32),
54 ..Default::default()
55 },
56 max_size: stretch::geometry::Size {
57 height: stretch::style::Dimension::Points(500f32),
58 ..Default::default()
59 },
60 ..Default::default()
61 },
62 vec![node0],
63 )
64 .unwrap();
65 stretch.compute_layout(node, stretch::geometry::Size::undefined()).unwrap();
66 assert_eq!(stretch.layout(node).unwrap().size.width, 100f32);
67 assert_eq!(stretch.layout(node).unwrap().size.height, 300f32);
68 assert_eq!(stretch.layout(node).unwrap().location.x, 0f32);
69 assert_eq!(stretch.layout(node).unwrap().location.y, 0f32);
70 assert_eq!(stretch.layout(node0).unwrap().size.width, 100f32);
71 assert_eq!(stretch.layout(node0).unwrap().size.height, 300f32);
72 assert_eq!(stretch.layout(node0).unwrap().location.x, 0f32);
73 assert_eq!(stretch.layout(node0).unwrap().location.y, 0f32);
74 assert_eq!(stretch.layout(node00).unwrap().size.width, 100f32);
75 assert_eq!(stretch.layout(node00).unwrap().size.height, 200f32);
76 assert_eq!(stretch.layout(node00).unwrap().location.x, 0f32);
77 assert_eq!(stretch.layout(node00).unwrap().location.y, 0f32);
78 assert_eq!(stretch.layout(node01).unwrap().size.width, 100f32);
79 assert_eq!(stretch.layout(node01).unwrap().size.height, 100f32);
80 assert_eq!(stretch.layout(node01).unwrap().location.x, 0f32);
81 assert_eq!(stretch.layout(node01).unwrap().location.y, 200f32);
82}