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