gioser

tawasuyu/taffy

A high performance rust-powered UI layout library

HTML 5544Rust 88Markdown 11TOML 91926 Definitions

⎇ dff7bef4e12d1cb436e7e50839242170379bd998 tests/generated/border_no_child.rs Rust · 24 lines · 957 B History Who touched what raw

Rename Rect field start->left end->right (#257) ca514f6c8 · Nico Burns ·

1#[test]
2fn border_no_child() {
3    let mut taffy = taffy::Taffy::new();
4    let node = taffy
5        .new_with_children(
6            taffy::style::Style {
7                border: taffy::geometry::Rect {
8                    left: taffy::style::Dimension::Points(10f32),
9                    right: taffy::style::Dimension::Points(10f32),
10                    top: taffy::style::Dimension::Points(10f32),
11                    bottom: taffy::style::Dimension::Points(10f32),
12                    ..Default::default()
13                },
14                ..Default::default()
15            },
16            &[],
17        )
18        .unwrap();
19    taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
20    assert_eq!(taffy.layout(node).unwrap().size.width, 20f32);
21    assert_eq!(taffy.layout(node).unwrap().size.height, 20f32);
22    assert_eq!(taffy.layout(node).unwrap().location.x, 0f32);
23    assert_eq!(taffy.layout(node).unwrap().location.y, 0f32);
24}