⎇ 9950fe891998e1d08e8b79ce5cc6320efda0941f
tests/generated/percent_within_flex_grow.rs
Ñawpa willay
Pi imata llamkarqan
ch'uya
update tests and benchmarks to use new api
1#[test]
2fn percent_within_flex_grow() {
3 let layout = stretch::node::Node::new(
4 stretch::style::Style {
5 size: stretch::geometry::Size {
6 width: stretch::style::Dimension::Points(350f32),
7 height: stretch::style::Dimension::Points(100f32),
8 ..Default::default()
9 },
10 ..Default::default()
11 },
12 vec![
13 &stretch::node::Node::new(
14 stretch::style::Style {
15 size: stretch::geometry::Size {
16 width: stretch::style::Dimension::Points(100f32),
17 ..Default::default()
18 },
19 ..Default::default()
20 },
21 vec![],
22 ),
23 &stretch::node::Node::new(
24 stretch::style::Style {
25 flex_direction: stretch::style::FlexDirection::Column,
26 flex_grow: 1f32,
27 ..Default::default()
28 },
29 vec![&stretch::node::Node::new(
30 stretch::style::Style {
31 size: stretch::geometry::Size {
32 width: stretch::style::Dimension::Percent(1f32),
33 ..Default::default()
34 },
35 ..Default::default()
36 },
37 vec![],
38 )],
39 ),
40 &stretch::node::Node::new(
41 stretch::style::Style {
42 size: stretch::geometry::Size {
43 width: stretch::style::Dimension::Points(100f32),
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, 350f32);
55 assert_eq!(layout.size.height, 100f32);
56 assert_eq!(layout.location.x, 0f32);
57 assert_eq!(layout.location.y, 0f32);
58 assert_eq!(layout.children[0usize].size.width, 100f32);
59 assert_eq!(layout.children[0usize].size.height, 100f32);
60 assert_eq!(layout.children[0usize].location.x, 0f32);
61 assert_eq!(layout.children[0usize].location.y, 0f32);
62 assert_eq!(layout.children[1usize].size.width, 150f32);
63 assert_eq!(layout.children[1usize].size.height, 100f32);
64 assert_eq!(layout.children[1usize].location.x, 100f32);
65 assert_eq!(layout.children[1usize].location.y, 0f32);
66 assert_eq!(layout.children[1usize].children[0usize].size.width, 150f32);
67 assert_eq!(layout.children[1usize].children[0usize].size.height, 0f32);
68 assert_eq!(layout.children[1usize].children[0usize].location.x, 0f32);
69 assert_eq!(layout.children[1usize].children[0usize].location.y, 0f32);
70 assert_eq!(layout.children[2usize].size.width, 100f32);
71 assert_eq!(layout.children[2usize].size.height, 100f32);
72 assert_eq!(layout.children[2usize].location.x, 250f32);
73 assert_eq!(layout.children[2usize].location.y, 0f32);
74}