tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

HTML 231Rust 10TOML 3CSS 1350 Definiciones

⎇ bce89b1006f36ce35abfaf1f1c2b3dd95f3dffd3 tests/generated/flex_basis_unconstraint_column.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 flex_basis_unconstraint_column() {
3    let mut stretch = stretch::Stretch::new();
4    let node0 = stretch
5        .new_node(
6            stretch::style::Style {
7                flex_basis: stretch::style::Dimension::Points(50f32),
8                size: stretch::geometry::Size {
9                    width: stretch::style::Dimension::Points(100f32),
10                    ..Default::default()
11                },
12                ..Default::default()
13            },
14            vec![],
15        )
16        .unwrap();
17    let node = stretch
18        .new_node(
19            stretch::style::Style { flex_direction: stretch::style::FlexDirection::Column, ..Default::default() },
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, 50f32);
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, 100f32);
29    assert_eq!(stretch.layout(node0).unwrap().size.height, 50f32);
30    assert_eq!(stretch.layout(node0).unwrap().location.x, 0f32);
31    assert_eq!(stretch.layout(node0).unwrap().location.y, 0f32);
32}