tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 583HTML 275Markdown 8TOML 41586 Sutichaykuna

⎇ 272bca7d9b110816a1ac3ff828d441f4acb3449f tests/generated/flex_basis_smaller_than_content_column.rs Rust · 37 siq'ikuna · 1.7 KB Ñawpa willay Pi imata llamkarqan ch'uya

Generate benchmarks for all test fixtures 272bca7d9 · Emil Sjölander ·

1#[test]
2fn flex_basis_smaller_than_content_column() {
3    let layout = stretch::compute(
4        &stretch::style::Node {
5            flex_direction: stretch::style::FlexDirection::Column,
6            size: stretch::geometry::Size { height: stretch::style::Dimension::Points(100f32), ..Default::default() },
7            children: vec![stretch::style::Node {
8                flex_direction: stretch::style::FlexDirection::Column,
9                flex_basis: stretch::style::Dimension::Points(50f32),
10                children: vec![stretch::style::Node {
11                    size: stretch::geometry::Size {
12                        width: stretch::style::Dimension::Points(100f32),
13                        height: stretch::style::Dimension::Points(100f32),
14                        ..Default::default()
15                    },
16                    ..Default::default()
17                }],
18                ..Default::default()
19            }],
20            ..Default::default()
21        },
22        stretch::geometry::Size::undefined(),
23    )
24    .unwrap();
25    assert_eq!(layout.size.width, 100f32);
26    assert_eq!(layout.size.height, 100f32);
27    assert_eq!(layout.location.x, 0f32);
28    assert_eq!(layout.location.y, 0f32);
29    assert_eq!(layout.children[0usize].size.width, 100f32);
30    assert_eq!(layout.children[0usize].size.height, 100f32);
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, 100f32);
34    assert_eq!(layout.children[0usize].children[0usize].size.height, 100f32);
35    assert_eq!(layout.children[0usize].children[0usize].location.x, 0f32);
36    assert_eq!(layout.children[0usize].children[0usize].location.y, 0f32);
37}