tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

⎇ 3de41935b1054f945bfaeb40dfc213cd57366b9b tests/generated/margin_with_sibling_row.rs Rust · 41 siq'ikuna · 1.6 KB Ñawpa willay Pi imata llamkarqan ch'uya

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

1#[test]
2fn margin_with_sibling_row() {
3    let layout = stretch::node::Node::new(
4        stretch::style::Style {
5            size: stretch::geometry::Size {
6                width: stretch::style::Dimension::Points(100f32),
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                    flex_grow: 1f32,
16                    margin: stretch::geometry::Rect {
17                        end: stretch::style::Dimension::Points(10f32),
18                        ..Default::default()
19                    },
20                    ..Default::default()
21                },
22                vec![],
23            ),
24            &stretch::node::Node::new(stretch::style::Style { flex_grow: 1f32, ..Default::default() }, vec![]),
25        ],
26    )
27    .compute_layout(stretch::geometry::Size::undefined())
28    .unwrap();
29    assert_eq!(layout.size.width, 100f32);
30    assert_eq!(layout.size.height, 100f32);
31    assert_eq!(layout.location.x, 0f32);
32    assert_eq!(layout.location.y, 0f32);
33    assert_eq!(layout.children[0usize].size.width, 45f32);
34    assert_eq!(layout.children[0usize].size.height, 100f32);
35    assert_eq!(layout.children[0usize].location.x, 0f32);
36    assert_eq!(layout.children[0usize].location.y, 0f32);
37    assert_eq!(layout.children[1usize].size.width, 45f32);
38    assert_eq!(layout.children[1usize].size.height, 100f32);
39    assert_eq!(layout.children[1usize].location.x, 55f32);
40    assert_eq!(layout.children[1usize].location.y, 0f32);
41}