⎇ a149c6b6b8f7d25328e78ba649b76d1841c55d9d
tests/generated/min_max_percent_no_width_height.rs
Ñawpa willay
Pi imata llamkarqan
ch'uya
index: update tests to API changes
1#[test]
2fn min_max_percent_no_width_height() {
3 let mut stretch = stretch::Stretch::new();
4 let node0 = stretch
5 .new_node(
6 stretch::style::Style {
7 min_size: stretch::geometry::Size {
8 width: stretch::style::Dimension::Percent(0.1f32),
9 height: stretch::style::Dimension::Percent(0.1f32),
10 ..Default::default()
11 },
12 max_size: stretch::geometry::Size {
13 width: stretch::style::Dimension::Percent(0.1f32),
14 height: stretch::style::Dimension::Percent(0.1f32),
15 ..Default::default()
16 },
17 ..Default::default()
18 },
19 vec![],
20 )
21 .unwrap();
22 let node = stretch
23 .new_node(
24 stretch::style::Style {
25 flex_direction: stretch::style::FlexDirection::Column,
26 align_items: stretch::style::AlignItems::FlexStart,
27 size: stretch::geometry::Size {
28 width: stretch::style::Dimension::Points(100f32),
29 height: stretch::style::Dimension::Points(100f32),
30 ..Default::default()
31 },
32 ..Default::default()
33 },
34 vec![node0],
35 )
36 .unwrap();
37 stretch.compute_layout(node, stretch::geometry::Size::undefined()).unwrap();
38 assert_eq!(stretch.layout(node).unwrap().size.width, 100f32);
39 assert_eq!(stretch.layout(node).unwrap().size.height, 100f32);
40 assert_eq!(stretch.layout(node).unwrap().location.x, 0f32);
41 assert_eq!(stretch.layout(node).unwrap().location.y, 0f32);
42 assert_eq!(stretch.layout(node0).unwrap().size.width, 10f32);
43 assert_eq!(stretch.layout(node0).unwrap().size.height, 10f32);
44 assert_eq!(stretch.layout(node0).unwrap().location.x, 0f32);
45 assert_eq!(stretch.layout(node0).unwrap().location.y, 0f32);
46}