gioser

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 499HTML 238Markdown 7TOML 31442 Definiciones

⎇ ac3349ce0fd60591d6019a4658dfe84912514e62 tests/generated/flex_direction_column_reverse.rs Rust · 59 líneas · 2.3 KB Historia Quién tocó qué crudo

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

1#[test]
2fn flex_direction_column_reverse() {
3    let layout = stretch::compute(
4        &stretch::style::Node {
5            flex_direction: stretch::style::FlexDirection::ColumnReverse,
6            size: stretch::geometry::Size {
7                width: stretch::style::Dimension::Points(100.0000),
8                height: stretch::style::Dimension::Points(100.0000),
9                ..Default::default()
10            },
11            children: vec![
12                stretch::style::Node {
13                    size: stretch::geometry::Size {
14                        height: stretch::style::Dimension::Points(10.0000),
15                        ..Default::default()
16                    },
17                    ..Default::default()
18                },
19                stretch::style::Node {
20                    size: stretch::geometry::Size {
21                        height: stretch::style::Dimension::Points(10.0000),
22                        ..Default::default()
23                    },
24                    ..Default::default()
25                },
26                stretch::style::Node {
27                    size: stretch::geometry::Size {
28                        height: stretch::style::Dimension::Points(10.0000),
29                        ..Default::default()
30                    },
31                    ..Default::default()
32                },
33            ],
34            ..Default::default()
35        },
36        stretch::geometry::Size::undefined(),
37    )
38    .unwrap();
39
40    assert_eq!(layout.size.width, 100.0000);
41    assert_eq!(layout.size.height, 100.0000);
42    assert_eq!(layout.location.x, 0.0000);
43    assert_eq!(layout.location.y, 0.0000);
44
45    assert_eq!(layout.children[0].size.width, 100.0000);
46    assert_eq!(layout.children[0].size.height, 10.0000);
47    assert_eq!(layout.children[0].location.x, 0.0000);
48    assert_eq!(layout.children[0].location.y, 90.0000);
49
50    assert_eq!(layout.children[1].size.width, 100.0000);
51    assert_eq!(layout.children[1].size.height, 10.0000);
52    assert_eq!(layout.children[1].location.x, 0.0000);
53    assert_eq!(layout.children[1].location.y, 80.0000);
54
55    assert_eq!(layout.children[2].size.width, 100.0000);
56    assert_eq!(layout.children[2].size.height, 10.0000);
57    assert_eq!(layout.children[2].location.x, 0.0000);
58    assert_eq!(layout.children[2].location.y, 70.0000);
59}