tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

HTML 5464Rust 87Markdown 12TOML 91903 Definiciones

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

index: update tests to API changes 48c69198a · msiglreith ·

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