gioser

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 501HTML 254C 19JavaScript 81414 Definitions

⎇ ac3349ce0fd60591d6019a4658dfe84912514e62 tests/generated/wrap_reverse_row.rs Rust · 71 lines · 2.9 KB History Who touched what raw

[gentest] Split generated tests into separate files. ac3349ce0 · Adam Perry ·

1#[test]
2fn wrap_reverse_row() {
3    let layout = stretch::compute(
4        &stretch::style::Node {
5            flex_wrap: stretch::style::FlexWrap::WrapReverse,
6            size: stretch::geometry::Size { width: stretch::style::Dimension::Points(100.0000), ..Default::default() },
7            children: vec![
8                stretch::style::Node {
9                    size: stretch::geometry::Size {
10                        width: stretch::style::Dimension::Points(31.0000),
11                        height: stretch::style::Dimension::Points(30.0000),
12                        ..Default::default()
13                    },
14                    ..Default::default()
15                },
16                stretch::style::Node {
17                    size: stretch::geometry::Size {
18                        width: stretch::style::Dimension::Points(32.0000),
19                        height: stretch::style::Dimension::Points(30.0000),
20                        ..Default::default()
21                    },
22                    ..Default::default()
23                },
24                stretch::style::Node {
25                    size: stretch::geometry::Size {
26                        width: stretch::style::Dimension::Points(33.0000),
27                        height: stretch::style::Dimension::Points(30.0000),
28                        ..Default::default()
29                    },
30                    ..Default::default()
31                },
32                stretch::style::Node {
33                    size: stretch::geometry::Size {
34                        width: stretch::style::Dimension::Points(34.0000),
35                        height: stretch::style::Dimension::Points(30.0000),
36                        ..Default::default()
37                    },
38                    ..Default::default()
39                },
40            ],
41            ..Default::default()
42        },
43        stretch::geometry::Size::undefined(),
44    )
45    .unwrap();
46
47    assert_eq!(layout.size.width, 100.0000);
48    assert_eq!(layout.size.height, 60.0000);
49    assert_eq!(layout.location.x, 0.0000);
50    assert_eq!(layout.location.y, 0.0000);
51
52    assert_eq!(layout.children[0].size.width, 31.0000);
53    assert_eq!(layout.children[0].size.height, 30.0000);
54    assert_eq!(layout.children[0].location.x, 0.0000);
55    assert_eq!(layout.children[0].location.y, 30.0000);
56
57    assert_eq!(layout.children[1].size.width, 32.0000);
58    assert_eq!(layout.children[1].size.height, 30.0000);
59    assert_eq!(layout.children[1].location.x, 31.0000);
60    assert_eq!(layout.children[1].location.y, 30.0000);
61
62    assert_eq!(layout.children[2].size.width, 33.0000);
63    assert_eq!(layout.children[2].size.height, 30.0000);
64    assert_eq!(layout.children[2].location.x, 63.0000);
65    assert_eq!(layout.children[2].location.y, 30.0000);
66
67    assert_eq!(layout.children[3].size.width, 34.0000);
68    assert_eq!(layout.children[3].size.height, 30.0000);
69    assert_eq!(layout.children[3].location.x, 0.0000);
70    assert_eq!(layout.children[3].location.y, 0.0000);
71}