tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 1077HTML 1008Markdown 12TOML 83209 Definitions

⎇ 076aca1b7e6f8d292ac3a13f1565ac94aaf1f5bd tests/generated.rs Rust · 27 lines · 854 B History Who touched what raw

Basic test generation working 076aca1b7 · Emil Sjölander ·

1#[cfg(test)]
2mod generated {
3    #[test]
4    fn sample() {
5        let layout = stretch::compute(&stretch::style::Node {
6            width: stretch::style::Dimension::Points(100.0),
7            height: stretch::style::Dimension::Points(100.0),
8            children: vec![stretch::style::Node {
9                width: stretch::style::Dimension::Points(50.0),
10                children: vec![],
11                ..Default::default()
12            }],
13            ..Default::default()
14        });
15
16        assert_eq!(layout.width, 100.0);
17        assert_eq!(layout.height, 100.0);
18        assert_eq!(layout.x, 0.0);
19        assert_eq!(layout.y, 0.0);
20
21        assert_eq!(layout.children[0].width, 50.0);
22        assert_eq!(layout.children[0].height, 100.0);
23        assert_eq!(layout.children[0].x, 0.0);
24        assert_eq!(layout.children[0].y, 0.0);
25    }
26
27}