⎇ bce89b1006f36ce35abfaf1f1c2b3dd95f3dffd3
tests/generated/flex_grow_within_constrained_max_row.rs
Historia
Quién tocó qué
crudo
index: update tests to API changes
1#[test]
2fn flex_grow_within_constrained_max_row() {
3 let mut stretch = stretch::Stretch::new();
4 let node00 = stretch
5 .new_node(
6 stretch::style::Style {
7 flex_shrink: 1f32,
8 flex_basis: stretch::style::Dimension::Points(100f32),
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 { width: stretch::style::Dimension::Points(50f32), ..Default::default() },
18 ..Default::default()
19 },
20 vec![],
21 )
22 .unwrap();
23 let node0 = stretch
24 .new_node(
25 stretch::style::Style {
26 size: stretch::geometry::Size {
27 height: stretch::style::Dimension::Points(100f32),
28 ..Default::default()
29 },
30 max_size: stretch::geometry::Size {
31 width: stretch::style::Dimension::Points(100f32),
32 ..Default::default()
33 },
34 ..Default::default()
35 },
36 vec![node00, node01],
37 )
38 .unwrap();
39 let node = stretch
40 .new_node(
41 stretch::style::Style {
42 flex_direction: stretch::style::FlexDirection::Column,
43 size: stretch::geometry::Size {
44 width: stretch::style::Dimension::Points(200f32),
45 ..Default::default()
46 },
47 ..Default::default()
48 },
49 vec![node0],
50 )
51 .unwrap();
52 stretch.compute_layout(node, stretch::geometry::Size::undefined()).unwrap();
53 assert_eq!(stretch.layout(node).unwrap().size.width, 200f32);
54 assert_eq!(stretch.layout(node).unwrap().size.height, 100f32);
55 assert_eq!(stretch.layout(node).unwrap().location.x, 0f32);
56 assert_eq!(stretch.layout(node).unwrap().location.y, 0f32);
57 assert_eq!(stretch.layout(node0).unwrap().size.width, 100f32);
58 assert_eq!(stretch.layout(node0).unwrap().size.height, 100f32);
59 assert_eq!(stretch.layout(node0).unwrap().location.x, 0f32);
60 assert_eq!(stretch.layout(node0).unwrap().location.y, 0f32);
61 assert_eq!(stretch.layout(node00).unwrap().size.width, 67f32);
62 assert_eq!(stretch.layout(node00).unwrap().size.height, 100f32);
63 assert_eq!(stretch.layout(node00).unwrap().location.x, 0f32);
64 assert_eq!(stretch.layout(node00).unwrap().location.y, 0f32);
65 assert_eq!(stretch.layout(node01).unwrap().size.width, 33f32);
66 assert_eq!(stretch.layout(node01).unwrap().size.height, 100f32);
67 assert_eq!(stretch.layout(node01).unwrap().location.x, 67f32);
68 assert_eq!(stretch.layout(node01).unwrap().location.y, 0f32);
69}