gioser

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 497HTML 254C 19JavaScript 81329 Definiciones

⎇ 9950fe891998e1d08e8b79ce5cc6320efda0941f tests/generated/margin_should_not_be_part_of_max_height.rs Rust · 39 líneas · 1.6 KB Historia Quién tocó qué crudo

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

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