tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 695HTML 648Markdown 12TOML 62320 Definiciones

⎇ bce89b1006f36ce35abfaf1f1c2b3dd95f3dffd3 tests/generated/max_width_overrides_width.rs Rust · 30 líneas · 1.3 KB Historia Quién tocó qué crudo

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

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