⎇ a149c6b6b8f7d25328e78ba649b76d1841c55d9d
tests/generated/flex_shrink_flex_grow_row.rs
History
Who touched what
raw
index: update tests to API changes
1#[test]
2fn flex_shrink_flex_grow_row() {
3 let mut stretch = stretch::Stretch::new();
4 let node0 = stretch
5 .new_node(
6 stretch::style::Style {
7 flex_grow: 0f32,
8 flex_shrink: 1f32,
9 size: stretch::geometry::Size {
10 width: stretch::style::Dimension::Points(500f32),
11 height: stretch::style::Dimension::Points(100f32),
12 ..Default::default()
13 },
14 ..Default::default()
15 },
16 vec![],
17 )
18 .unwrap();
19 let node1 = stretch
20 .new_node(
21 stretch::style::Style {
22 flex_grow: 0f32,
23 flex_shrink: 1f32,
24 size: stretch::geometry::Size {
25 width: stretch::style::Dimension::Points(500f32),
26 height: stretch::style::Dimension::Points(100f32),
27 ..Default::default()
28 },
29 ..Default::default()
30 },
31 vec![],
32 )
33 .unwrap();
34 let node = stretch
35 .new_node(
36 stretch::style::Style {
37 size: stretch::geometry::Size {
38 width: stretch::style::Dimension::Points(500f32),
39 height: stretch::style::Dimension::Points(500f32),
40 ..Default::default()
41 },
42 ..Default::default()
43 },
44 vec![node0, node1],
45 )
46 .unwrap();
47 stretch.compute_layout(node, stretch::geometry::Size::undefined()).unwrap();
48 assert_eq!(stretch.layout(node).unwrap().size.width, 500f32);
49 assert_eq!(stretch.layout(node).unwrap().size.height, 500f32);
50 assert_eq!(stretch.layout(node).unwrap().location.x, 0f32);
51 assert_eq!(stretch.layout(node).unwrap().location.y, 0f32);
52 assert_eq!(stretch.layout(node0).unwrap().size.width, 250f32);
53 assert_eq!(stretch.layout(node0).unwrap().size.height, 100f32);
54 assert_eq!(stretch.layout(node0).unwrap().location.x, 0f32);
55 assert_eq!(stretch.layout(node0).unwrap().location.y, 0f32);
56 assert_eq!(stretch.layout(node1).unwrap().size.width, 250f32);
57 assert_eq!(stretch.layout(node1).unwrap().size.height, 100f32);
58 assert_eq!(stretch.layout(node1).unwrap().location.x, 250f32);
59 assert_eq!(stretch.layout(node1).unwrap().location.y, 0f32);
60}