gioser

tawasuyu/taffy

A high performance rust-powered UI layout library

HTML 238Rust 12TOML 3CSS 1143 Sutichaykuna

⎇ 54e00d63d6d4a99e89ac0934a6bb61e415ab1006 tests/generated/flex_basis_larger_than_content_row.rs Rust · 41 siq'ikuna · 1.8 KB Ñawpa willay Pi imata llamkarqan ch'uya

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

1#[test]
2fn flex_basis_larger_than_content_row() {
3    let layout = stretch::node::Node::new(
4        stretch::style::Style {
5            size: stretch::geometry::Size { width: stretch::style::Dimension::Points(100f32), ..Default::default() },
6            ..Default::default()
7        },
8        vec![&stretch::node::Node::new(
9            stretch::style::Style {
10                flex_direction: stretch::style::FlexDirection::Column,
11                flex_basis: stretch::style::Dimension::Points(50f32),
12                ..Default::default()
13            },
14            vec![&stretch::node::Node::new(
15                stretch::style::Style {
16                    size: stretch::geometry::Size {
17                        width: stretch::style::Dimension::Points(10f32),
18                        height: stretch::style::Dimension::Points(100f32),
19                        ..Default::default()
20                    },
21                    ..Default::default()
22                },
23                vec![],
24            )],
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, 50f32);
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[0usize].children[0usize].size.width, 10f32);
38    assert_eq!(layout.children[0usize].children[0usize].size.height, 100f32);
39    assert_eq!(layout.children[0usize].children[0usize].location.x, 0f32);
40    assert_eq!(layout.children[0usize].children[0usize].location.y, 0f32);
41}