gioser

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 1061HTML 997Markdown 12TOML 83120 Definiciones

⎇ 0.2.x tests/generated/padding_no_child.rs Rust · 24 líneas · 959 B Historia Quién tocó qué crudo

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

1#[test]
2fn padding_no_child() {
3    let mut taffy = taffy::Taffy::new();
4    let node = taffy
5        .new_with_children(
6            taffy::style::Style {
7                padding: 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}