tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 501HTML 254C 19JavaScript 81414 Sutichaykuna

⎇ d67e82255da07928c7e415ea7364529d204bbaf9 tests/generated/min_width_overrides_width.rs Rust · 30 siq'ikuna · 1.3 KB Ñawpa willay Pi imata llamkarqan ch'uya

Fix formatting d67e82255 · elbaro ·

1#[test]
2fn min_width_overrides_width() {
3    let mut stretch = stretch2::Stretch::new();
4    let node0 = stretch
5        .new_node(
6            stretch2::style::Style {
7                size: stretch2::geometry::Size {
8                    width: stretch2::style::Dimension::Points(50f32),
9                    ..Default::default()
10                },
11                min_size: stretch2::geometry::Size {
12                    width: stretch2::style::Dimension::Points(100f32),
13                    ..Default::default()
14                },
15                ..Default::default()
16            },
17            &[],
18        )
19        .unwrap();
20    let node = stretch.new_node(stretch2::style::Style { ..Default::default() }, &[node0]).unwrap();
21    stretch.compute_layout(node, stretch2::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}