gioser

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 252HTML 238TOML 3CSS 1626 Definitions

⎇ 9950fe891998e1d08e8b79ce5cc6320efda0941f tests/generated/border_stretch_child.rs Rust · 37 lines · 1.5 KB History Who touched what raw

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

1#[test]
2fn border_stretch_child() {
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            border: stretch::geometry::Rect {
11                start: stretch::style::Dimension::Points(10f32),
12                end: stretch::style::Dimension::Points(10f32),
13                top: stretch::style::Dimension::Points(10f32),
14                bottom: stretch::style::Dimension::Points(10f32),
15                ..Default::default()
16            },
17            ..Default::default()
18        },
19        vec![&stretch::node::Node::new(
20            stretch::style::Style {
21                size: stretch::geometry::Size { width: stretch::style::Dimension::Points(10f32), ..Default::default() },
22                ..Default::default()
23            },
24            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, 10f32);
34    assert_eq!(layout.children[0usize].size.height, 80f32);
35    assert_eq!(layout.children[0usize].location.x, 10f32);
36    assert_eq!(layout.children[0usize].location.y, 10f32);
37}