⎇ 54e00d63d6d4a99e89ac0934a6bb61e415ab1006
tests/generated/margin_auto_mutiple_children_column.rs
History
Who touched what
raw
update tests and benchmarks to use new api
1#[test]
2fn margin_auto_mutiple_children_column() {
3 let layout = stretch::node::Node::new(
4 stretch::style::Style {
5 flex_direction: stretch::style::FlexDirection::Column,
6 align_items: stretch::style::AlignItems::Center,
7 size: stretch::geometry::Size {
8 width: stretch::style::Dimension::Points(200f32),
9 height: stretch::style::Dimension::Points(200f32),
10 ..Default::default()
11 },
12 ..Default::default()
13 },
14 vec![
15 &stretch::node::Node::new(
16 stretch::style::Style {
17 size: stretch::geometry::Size {
18 width: stretch::style::Dimension::Points(50f32),
19 height: stretch::style::Dimension::Points(50f32),
20 ..Default::default()
21 },
22 margin: stretch::geometry::Rect { top: stretch::style::Dimension::Auto, ..Default::default() },
23 ..Default::default()
24 },
25 vec![],
26 ),
27 &stretch::node::Node::new(
28 stretch::style::Style {
29 size: stretch::geometry::Size {
30 width: stretch::style::Dimension::Points(50f32),
31 height: stretch::style::Dimension::Points(50f32),
32 ..Default::default()
33 },
34 margin: stretch::geometry::Rect { top: stretch::style::Dimension::Auto, ..Default::default() },
35 ..Default::default()
36 },
37 vec![],
38 ),
39 &stretch::node::Node::new(
40 stretch::style::Style {
41 size: stretch::geometry::Size {
42 width: stretch::style::Dimension::Points(50f32),
43 height: stretch::style::Dimension::Points(50f32),
44 ..Default::default()
45 },
46 ..Default::default()
47 },
48 vec![],
49 ),
50 ],
51 )
52 .compute_layout(stretch::geometry::Size::undefined())
53 .unwrap();
54 assert_eq!(layout.size.width, 200f32);
55 assert_eq!(layout.size.height, 200f32);
56 assert_eq!(layout.location.x, 0f32);
57 assert_eq!(layout.location.y, 0f32);
58 assert_eq!(layout.children[0usize].size.width, 50f32);
59 assert_eq!(layout.children[0usize].size.height, 50f32);
60 assert_eq!(layout.children[0usize].location.x, 75f32);
61 assert_eq!(layout.children[0usize].location.y, 25f32);
62 assert_eq!(layout.children[1usize].size.width, 50f32);
63 assert_eq!(layout.children[1usize].size.height, 50f32);
64 assert_eq!(layout.children[1usize].location.x, 75f32);
65 assert_eq!(layout.children[1usize].location.y, 100f32);
66 assert_eq!(layout.children[2usize].size.width, 50f32);
67 assert_eq!(layout.children[2usize].size.height, 50f32);
68 assert_eq!(layout.children[2usize].location.x, 75f32);
69 assert_eq!(layout.children[2usize].location.y, 150f32);
70}