tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

HTML 231Rust 9TOML 3CSS 1345 Sutichaykuna

⎇ c086b48b5cd3f9fe065429a91928fdf8bab1be83 tests/generated.rs Rust · 27 siq'ikuna · 854 B Ñawpa willay Pi imata llamkarqan ch'uya

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}