gioser

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 1076HTML 1008Markdown 12TOML 83208 Definiciones

⎇ ac3349ce0fd60591d6019a4658dfe84912514e62 tests/generated/justify_content_row_max_width_and_margin.rs Rust · 38 líneas · 1.5 KB Historia Quién tocó qué crudo

[gentest] Split generated tests into separate files. ac3349ce0 · Adam Perry ·

1#[test]
2fn justify_content_row_max_width_and_margin() {
3    let layout = stretch::compute(
4        &stretch::style::Node {
5            justify_content: stretch::style::JustifyContent::Center,
6            size: stretch::geometry::Size { width: stretch::style::Dimension::Points(100.0000), ..Default::default() },
7            max_size: stretch::geometry::Size {
8                width: stretch::style::Dimension::Points(80.0000),
9                ..Default::default()
10            },
11            children: vec![stretch::style::Node {
12                size: stretch::geometry::Size {
13                    width: stretch::style::Dimension::Points(20.0000),
14                    height: stretch::style::Dimension::Points(20.0000),
15                    ..Default::default()
16                },
17                margin: stretch::geometry::Rect {
18                    start: stretch::style::Dimension::Points(100.0000),
19                    ..Default::default()
20                },
21                ..Default::default()
22            }],
23            ..Default::default()
24        },
25        stretch::geometry::Size::undefined(),
26    )
27    .unwrap();
28
29    assert_eq!(layout.size.width, 80.0000);
30    assert_eq!(layout.size.height, 20.0000);
31    assert_eq!(layout.location.x, 0.0000);
32    assert_eq!(layout.location.y, 0.0000);
33
34    assert_eq!(layout.children[0].size.width, 0.0000);
35    assert_eq!(layout.children[0].size.height, 20.0000);
36    assert_eq!(layout.children[0].location.x, 90.0000);
37    assert_eq!(layout.children[0].location.y, 0.0000);
38}