gioser

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 492HTML 245JavaScript 8CSS 61138 Sutichaykuna

⎇ 9950fe891998e1d08e8b79ce5cc6320efda0941f tests/generated/size_defined_by_child.rs Rust · 27 siq'ikuna · 1.0 KB Ñawpa willay Pi imata llamkarqan ch'uya

update tests and benchmarks to use new api 1f8c44154 · Emil Sjölander ·

1#[test]
2fn size_defined_by_child() {
3    let layout = stretch::node::Node::new(
4        stretch::style::Style { ..Default::default() },
5        vec![&stretch::node::Node::new(
6            stretch::style::Style {
7                size: stretch::geometry::Size {
8                    width: stretch::style::Dimension::Points(100f32),
9                    height: stretch::style::Dimension::Points(100f32),
10                    ..Default::default()
11                },
12                ..Default::default()
13            },
14            vec![],
15        )],
16    )
17    .compute_layout(stretch::geometry::Size::undefined())
18    .unwrap();
19    assert_eq!(layout.size.width, 100f32);
20    assert_eq!(layout.size.height, 100f32);
21    assert_eq!(layout.location.x, 0f32);
22    assert_eq!(layout.location.y, 0f32);
23    assert_eq!(layout.children[0usize].size.width, 100f32);
24    assert_eq!(layout.children[0usize].size.height, 100f32);
25    assert_eq!(layout.children[0usize].location.x, 0f32);
26    assert_eq!(layout.children[0usize].location.y, 0f32);
27}