⎇ bce89b1006f36ce35abfaf1f1c2b3dd95f3dffd3
tests/generated/margin_auto_mutiple_children_row.rs
History
Who touched what
raw
index: update tests to API changes
1#[test]
2fn margin_auto_mutiple_children_row() {
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 { end: stretch::style::Dimension::Auto, ..Default::default() },
13 ..Default::default()
14 },
15 vec![],
16 )
17 .unwrap();
18 let node1 = stretch
19 .new_node(
20 stretch::style::Style {
21 size: stretch::geometry::Size {
22 width: stretch::style::Dimension::Points(50f32),
23 height: stretch::style::Dimension::Points(50f32),
24 ..Default::default()
25 },
26 margin: stretch::geometry::Rect { end: stretch::style::Dimension::Auto, ..Default::default() },
27 ..Default::default()
28 },
29 vec![],
30 )
31 .unwrap();
32 let node2 = stretch
33 .new_node(
34 stretch::style::Style {
35 size: stretch::geometry::Size {
36 width: stretch::style::Dimension::Points(50f32),
37 height: stretch::style::Dimension::Points(50f32),
38 ..Default::default()
39 },
40 ..Default::default()
41 },
42 vec![],
43 )
44 .unwrap();
45 let node = stretch
46 .new_node(
47 stretch::style::Style {
48 align_items: stretch::style::AlignItems::Center,
49 size: stretch::geometry::Size {
50 width: stretch::style::Dimension::Points(200f32),
51 height: stretch::style::Dimension::Points(200f32),
52 ..Default::default()
53 },
54 ..Default::default()
55 },
56 vec![node0, node1, node2],
57 )
58 .unwrap();
59 stretch.compute_layout(node, stretch::geometry::Size::undefined()).unwrap();
60 assert_eq!(stretch.layout(node).unwrap().size.width, 200f32);
61 assert_eq!(stretch.layout(node).unwrap().size.height, 200f32);
62 assert_eq!(stretch.layout(node).unwrap().location.x, 0f32);
63 assert_eq!(stretch.layout(node).unwrap().location.y, 0f32);
64 assert_eq!(stretch.layout(node0).unwrap().size.width, 50f32);
65 assert_eq!(stretch.layout(node0).unwrap().size.height, 50f32);
66 assert_eq!(stretch.layout(node0).unwrap().location.x, 0f32);
67 assert_eq!(stretch.layout(node0).unwrap().location.y, 75f32);
68 assert_eq!(stretch.layout(node1).unwrap().size.width, 50f32);
69 assert_eq!(stretch.layout(node1).unwrap().size.height, 50f32);
70 assert_eq!(stretch.layout(node1).unwrap().location.x, 75f32);
71 assert_eq!(stretch.layout(node1).unwrap().location.y, 75f32);
72 assert_eq!(stretch.layout(node2).unwrap().size.width, 50f32);
73 assert_eq!(stretch.layout(node2).unwrap().size.height, 50f32);
74 assert_eq!(stretch.layout(node2).unwrap().location.x, 150f32);
75 assert_eq!(stretch.layout(node2).unwrap().location.y, 75f32);
76}