gioser

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 501HTML 254C 19JavaScript 81414 Definiciones

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

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

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