gioser

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 500HTML 254C 19JavaScript 81398 Definiciones

⎇ ac3349ce0fd60591d6019a4658dfe84912514e62 tests/generated/max_width_overrides_width.rs Rust · 31 líneas · 1.1 KB Historia Quién tocó qué crudo

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

1#[test]
2fn max_width_overrides_width() {
3    let layout = stretch::compute(
4        &stretch::style::Node {
5            children: vec![stretch::style::Node {
6                size: stretch::geometry::Size {
7                    width: stretch::style::Dimension::Points(200.0000),
8                    ..Default::default()
9                },
10                max_size: stretch::geometry::Size {
11                    width: stretch::style::Dimension::Points(100.0000),
12                    ..Default::default()
13                },
14                ..Default::default()
15            }],
16            ..Default::default()
17        },
18        stretch::geometry::Size::undefined(),
19    )
20    .unwrap();
21
22    assert_eq!(layout.size.width, 100.0000);
23    assert_eq!(layout.size.height, 0.0000);
24    assert_eq!(layout.location.x, 0.0000);
25    assert_eq!(layout.location.y, 0.0000);
26
27    assert_eq!(layout.children[0].size.width, 100.0000);
28    assert_eq!(layout.children[0].size.height, 0.0000);
29    assert_eq!(layout.children[0].location.x, 0.0000);
30    assert_eq!(layout.children[0].location.y, 0.0000);
31}