tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

HTML 5544Rust 88Markdown 11TOML 91926 Sutichaykuna

⎇ a149c6b6b8f7d25328e78ba649b76d1841c55d9d tests/generated/justify_content_row_flex_start.rs Rust · 61 siq'ikuna · 2.5 KB Ñawpa willay Pi imata llamkarqan ch'uya

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

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