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