gioser

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 1116HTML 1041Markdown 12TOML 94780 Definiciones

⎇ ac3349ce0fd60591d6019a4658dfe84912514e62 tests/generated/absolute_layout_start_top_end_bottom.rs Rust · 36 líneas · 1.4 KB Historia Quién tocó qué crudo

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

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