tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 501HTML 254C 19JavaScript 81414 Sutichaykuna

⎇ bce89b1006f36ce35abfaf1f1c2b3dd95f3dffd3 tests/generated/parent_wrap_child_size_overflowing_parent.rs Rust · 55 siq'ikuna · 2.2 KB Ñawpa willay Pi imata llamkarqan ch'uya

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

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