tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 501HTML 254C 19JavaScript 81414 Definiciones

⎇ bce89b1006f36ce35abfaf1f1c2b3dd95f3dffd3 tests/generated/flex_grow_shrink_at_most.rs Rust · 34 líneas · 1.6 KB Historia Quién tocó qué crudo

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

1#[test]
2fn flex_grow_shrink_at_most() {
3    let mut stretch = stretch::Stretch::new();
4    let node00 = stretch
5        .new_node(stretch::style::Style { flex_grow: 1f32, flex_shrink: 1f32, ..Default::default() }, vec![])
6        .unwrap();
7    let node0 = stretch.new_node(stretch::style::Style { ..Default::default() }, vec![node00]).unwrap();
8    let node = stretch
9        .new_node(
10            stretch::style::Style {
11                size: stretch::geometry::Size {
12                    width: stretch::style::Dimension::Points(100f32),
13                    height: stretch::style::Dimension::Points(100f32),
14                    ..Default::default()
15                },
16                ..Default::default()
17            },
18            vec![node0],
19        )
20        .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, 100f32);
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, 0f32);
27    assert_eq!(stretch.layout(node0).unwrap().size.height, 100f32);
28    assert_eq!(stretch.layout(node0).unwrap().location.x, 0f32);
29    assert_eq!(stretch.layout(node0).unwrap().location.y, 0f32);
30    assert_eq!(stretch.layout(node00).unwrap().size.width, 0f32);
31    assert_eq!(stretch.layout(node00).unwrap().size.height, 100f32);
32    assert_eq!(stretch.layout(node00).unwrap().location.x, 0f32);
33    assert_eq!(stretch.layout(node00).unwrap().location.y, 0f32);
34}