gioser

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 499HTML 245JavaScript 8CSS 61218 Sutichaykuna

⎇ 54e00d63d6d4a99e89ac0934a6bb61e415ab1006 tests/generated/wrap_row_align_items_flex_end.rs Rust · 79 siq'ikuna · 3.3 KB Ñawpa willay Pi imata llamkarqan ch'uya

update tests and benchmarks to use new api 1f8c44154 · Emil Sjölander ·

1#[test]
2fn wrap_row_align_items_flex_end() {
3    let layout = stretch::node::Node::new(
4        stretch::style::Style {
5            flex_wrap: stretch::style::FlexWrap::Wrap,
6            align_items: stretch::style::AlignItems::FlexEnd,
7            size: stretch::geometry::Size { width: stretch::style::Dimension::Points(100f32), ..Default::default() },
8            ..Default::default()
9        },
10        vec![
11            &stretch::node::Node::new(
12                stretch::style::Style {
13                    size: stretch::geometry::Size {
14                        width: stretch::style::Dimension::Points(30f32),
15                        height: stretch::style::Dimension::Points(10f32),
16                        ..Default::default()
17                    },
18                    ..Default::default()
19                },
20                vec![],
21            ),
22            &stretch::node::Node::new(
23                stretch::style::Style {
24                    size: stretch::geometry::Size {
25                        width: stretch::style::Dimension::Points(30f32),
26                        height: stretch::style::Dimension::Points(20f32),
27                        ..Default::default()
28                    },
29                    ..Default::default()
30                },
31                vec![],
32            ),
33            &stretch::node::Node::new(
34                stretch::style::Style {
35                    size: stretch::geometry::Size {
36                        width: stretch::style::Dimension::Points(30f32),
37                        height: stretch::style::Dimension::Points(30f32),
38                        ..Default::default()
39                    },
40                    ..Default::default()
41                },
42                vec![],
43            ),
44            &stretch::node::Node::new(
45                stretch::style::Style {
46                    size: stretch::geometry::Size {
47                        width: stretch::style::Dimension::Points(30f32),
48                        height: stretch::style::Dimension::Points(30f32),
49                        ..Default::default()
50                    },
51                    ..Default::default()
52                },
53                vec![],
54            ),
55        ],
56    )
57    .compute_layout(stretch::geometry::Size::undefined())
58    .unwrap();
59    assert_eq!(layout.size.width, 100f32);
60    assert_eq!(layout.size.height, 60f32);
61    assert_eq!(layout.location.x, 0f32);
62    assert_eq!(layout.location.y, 0f32);
63    assert_eq!(layout.children[0usize].size.width, 30f32);
64    assert_eq!(layout.children[0usize].size.height, 10f32);
65    assert_eq!(layout.children[0usize].location.x, 0f32);
66    assert_eq!(layout.children[0usize].location.y, 20f32);
67    assert_eq!(layout.children[1usize].size.width, 30f32);
68    assert_eq!(layout.children[1usize].size.height, 20f32);
69    assert_eq!(layout.children[1usize].location.x, 30f32);
70    assert_eq!(layout.children[1usize].location.y, 10f32);
71    assert_eq!(layout.children[2usize].size.width, 30f32);
72    assert_eq!(layout.children[2usize].size.height, 30f32);
73    assert_eq!(layout.children[2usize].location.x, 60f32);
74    assert_eq!(layout.children[2usize].location.y, 0f32);
75    assert_eq!(layout.children[3usize].size.width, 30f32);
76    assert_eq!(layout.children[3usize].size.height, 30f32);
77    assert_eq!(layout.children[3usize].location.x, 0f32);
78    assert_eq!(layout.children[3usize].location.y, 30f32);
79}