gioser

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 501HTML 254C 19JavaScript 81414 Definiciones

⎇ 9950fe891998e1d08e8b79ce5cc6320efda0941f tests/generated/flex_basis_smaller_than_main_dimen_column.rs Rust · 32 líneas · 1.3 KB Historia Quién tocó qué crudo

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

1#[test]
2fn flex_basis_smaller_than_main_dimen_column() {
3    let layout = stretch::node::Node::new(
4        stretch::style::Style {
5            flex_direction: stretch::style::FlexDirection::Column,
6            size: stretch::geometry::Size { height: stretch::style::Dimension::Points(100f32), ..Default::default() },
7            ..Default::default()
8        },
9        vec![&stretch::node::Node::new(
10            stretch::style::Style {
11                flex_basis: stretch::style::Dimension::Points(10f32),
12                size: stretch::geometry::Size {
13                    width: stretch::style::Dimension::Points(50f32),
14                    height: stretch::style::Dimension::Points(50f32),
15                    ..Default::default()
16                },
17                ..Default::default()
18            },
19            vec![],
20        )],
21    )
22    .compute_layout(stretch::geometry::Size::undefined())
23    .unwrap();
24    assert_eq!(layout.size.width, 50f32);
25    assert_eq!(layout.size.height, 100f32);
26    assert_eq!(layout.location.x, 0f32);
27    assert_eq!(layout.location.y, 0f32);
28    assert_eq!(layout.children[0usize].size.width, 50f32);
29    assert_eq!(layout.children[0usize].size.height, 10f32);
30    assert_eq!(layout.children[0usize].location.x, 0f32);
31    assert_eq!(layout.children[0usize].location.y, 0f32);
32}