tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 1100HTML 1031Markdown 12TOML 84455 Sutichaykuna

⎇ 7e05de8652da047a4d2a567bc03302e70d633c2c tests/generated/wrap_reverse_row_align_content_space_around.rs Rust · 94 siq'ikuna · 4.0 KB Ñawpa willay Pi imata llamkarqan ch'uya

update tests and benchmarks to use new api 1f8c44154 · Emil Sjölander ·

1#[test]
2fn wrap_reverse_row_align_content_space_around() {
3    let layout = stretch::node::Node::new(
4        stretch::style::Style {
5            flex_wrap: stretch::style::FlexWrap::WrapReverse,
6            align_content: stretch::style::AlignContent::SpaceAround,
7            size: stretch::geometry::Size { width: stretch::style::Dimension::Points(100f32), ..Default::default() },
8            ..Default::default()
9        },
10        vec![
11            &stretch::node::Node::new(
12                stretch::style::Style {
13                    size: stretch::geometry::Size {
14                        width: stretch::style::Dimension::Points(30f32),
15                        height: stretch::style::Dimension::Points(10f32),
16                        ..Default::default()
17                    },
18                    ..Default::default()
19                },
20                vec![],
21            ),
22            &stretch::node::Node::new(
23                stretch::style::Style {
24                    size: stretch::geometry::Size {
25                        width: stretch::style::Dimension::Points(30f32),
26                        height: stretch::style::Dimension::Points(20f32),
27                        ..Default::default()
28                    },
29                    ..Default::default()
30                },
31                vec![],
32            ),
33            &stretch::node::Node::new(
34                stretch::style::Style {
35                    size: stretch::geometry::Size {
36                        width: stretch::style::Dimension::Points(30f32),
37                        height: stretch::style::Dimension::Points(30f32),
38                        ..Default::default()
39                    },
40                    ..Default::default()
41                },
42                vec![],
43            ),
44            &stretch::node::Node::new(
45                stretch::style::Style {
46                    size: stretch::geometry::Size {
47                        width: stretch::style::Dimension::Points(30f32),
48                        height: stretch::style::Dimension::Points(40f32),
49                        ..Default::default()
50                    },
51                    ..Default::default()
52                },
53                vec![],
54            ),
55            &stretch::node::Node::new(
56                stretch::style::Style {
57                    size: stretch::geometry::Size {
58                        width: stretch::style::Dimension::Points(30f32),
59                        height: stretch::style::Dimension::Points(50f32),
60                        ..Default::default()
61                    },
62                    ..Default::default()
63                },
64                vec![],
65            ),
66        ],
67    )
68    .compute_layout(stretch::geometry::Size::undefined())
69    .unwrap();
70    assert_eq!(layout.size.width, 100f32);
71    assert_eq!(layout.size.height, 80f32);
72    assert_eq!(layout.location.x, 0f32);
73    assert_eq!(layout.location.y, 0f32);
74    assert_eq!(layout.children[0usize].size.width, 30f32);
75    assert_eq!(layout.children[0usize].size.height, 10f32);
76    assert_eq!(layout.children[0usize].location.x, 0f32);
77    assert_eq!(layout.children[0usize].location.y, 70f32);
78    assert_eq!(layout.children[1usize].size.width, 30f32);
79    assert_eq!(layout.children[1usize].size.height, 20f32);
80    assert_eq!(layout.children[1usize].location.x, 30f32);
81    assert_eq!(layout.children[1usize].location.y, 60f32);
82    assert_eq!(layout.children[2usize].size.width, 30f32);
83    assert_eq!(layout.children[2usize].size.height, 30f32);
84    assert_eq!(layout.children[2usize].location.x, 60f32);
85    assert_eq!(layout.children[2usize].location.y, 50f32);
86    assert_eq!(layout.children[3usize].size.width, 30f32);
87    assert_eq!(layout.children[3usize].size.height, 40f32);
88    assert_eq!(layout.children[3usize].location.x, 0f32);
89    assert_eq!(layout.children[3usize].location.y, 10f32);
90    assert_eq!(layout.children[4usize].size.width, 30f32);
91    assert_eq!(layout.children[4usize].size.height, 50f32);
92    assert_eq!(layout.children[4usize].location.x, 30f32);
93    assert_eq!(layout.children[4usize].location.y, 0f32);
94}