gioser

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 499HTML 254C 19JavaScript 81372 Definitions

⎇ 9950fe891998e1d08e8b79ce5cc6320efda0941f tests/generated/align_flex_start_with_stretching_children.rs Rust · 41 lines · 2.0 KB History Who touched what raw

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

1#[test]
2fn align_flex_start_with_stretching_children() {
3    let layout = stretch::node::Node::new(
4        stretch::style::Style {
5            size: stretch::geometry::Size {
6                width: stretch::style::Dimension::Points(500f32),
7                height: stretch::style::Dimension::Points(500f32),
8                ..Default::default()
9            },
10            ..Default::default()
11        },
12        vec![&stretch::node::Node::new(
13            stretch::style::Style { ..Default::default() },
14            vec![&stretch::node::Node::new(
15                stretch::style::Style { flex_grow: 1f32, flex_shrink: 1f32, ..Default::default() },
16                vec![&stretch::node::Node::new(
17                    stretch::style::Style { flex_grow: 1f32, flex_shrink: 1f32, ..Default::default() },
18                    vec![],
19                )],
20            )],
21        )],
22    )
23    .compute_layout(stretch::geometry::Size::undefined())
24    .unwrap();
25    assert_eq!(layout.size.width, 500f32);
26    assert_eq!(layout.size.height, 500f32);
27    assert_eq!(layout.location.x, 0f32);
28    assert_eq!(layout.location.y, 0f32);
29    assert_eq!(layout.children[0usize].size.width, 0f32);
30    assert_eq!(layout.children[0usize].size.height, 500f32);
31    assert_eq!(layout.children[0usize].location.x, 0f32);
32    assert_eq!(layout.children[0usize].location.y, 0f32);
33    assert_eq!(layout.children[0usize].children[0usize].size.width, 0f32);
34    assert_eq!(layout.children[0usize].children[0usize].size.height, 500f32);
35    assert_eq!(layout.children[0usize].children[0usize].location.x, 0f32);
36    assert_eq!(layout.children[0usize].children[0usize].location.y, 0f32);
37    assert_eq!(layout.children[0usize].children[0usize].children[0usize].size.width, 0f32);
38    assert_eq!(layout.children[0usize].children[0usize].children[0usize].size.height, 500f32);
39    assert_eq!(layout.children[0usize].children[0usize].children[0usize].location.x, 0f32);
40    assert_eq!(layout.children[0usize].children[0usize].children[0usize].location.y, 0f32);
41}