tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

HTML 231Rust 9TOML 3CSS 1345 Definiciones

⎇ d67e82255da07928c7e415ea7364529d204bbaf9 tests/generated/flex_grow_within_constrained_min_row.rs Rust · 46 líneas · 2.0 KB Historia Quién tocó qué crudo

Fix formatting d67e82255 · elbaro ·

1#[test]
2fn flex_grow_within_constrained_min_row() {
3    let mut stretch = stretch2::Stretch::new();
4    let node0 = stretch.new_node(stretch2::style::Style { flex_grow: 1f32, ..Default::default() }, &[]).unwrap();
5    let node1 = stretch
6        .new_node(
7            stretch2::style::Style {
8                size: stretch2::geometry::Size {
9                    width: stretch2::style::Dimension::Points(50f32),
10                    ..Default::default()
11                },
12                ..Default::default()
13            },
14            &[],
15        )
16        .unwrap();
17    let node = stretch
18        .new_node(
19            stretch2::style::Style {
20                size: stretch2::geometry::Size {
21                    height: stretch2::style::Dimension::Points(100f32),
22                    ..Default::default()
23                },
24                min_size: stretch2::geometry::Size {
25                    width: stretch2::style::Dimension::Points(100f32),
26                    ..Default::default()
27                },
28                ..Default::default()
29            },
30            &[node0, node1],
31        )
32        .unwrap();
33    stretch.compute_layout(node, stretch2::geometry::Size::undefined()).unwrap();
34    assert_eq!(stretch.layout(node).unwrap().size.width, 100f32);
35    assert_eq!(stretch.layout(node).unwrap().size.height, 100f32);
36    assert_eq!(stretch.layout(node).unwrap().location.x, 0f32);
37    assert_eq!(stretch.layout(node).unwrap().location.y, 0f32);
38    assert_eq!(stretch.layout(node0).unwrap().size.width, 50f32);
39    assert_eq!(stretch.layout(node0).unwrap().size.height, 100f32);
40    assert_eq!(stretch.layout(node0).unwrap().location.x, 0f32);
41    assert_eq!(stretch.layout(node0).unwrap().location.y, 0f32);
42    assert_eq!(stretch.layout(node1).unwrap().size.width, 50f32);
43    assert_eq!(stretch.layout(node1).unwrap().size.height, 100f32);
44    assert_eq!(stretch.layout(node1).unwrap().location.x, 50f32);
45    assert_eq!(stretch.layout(node1).unwrap().location.y, 0f32);
46}