tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

HTML 231Rust 9TOML 3CSS 1345 Definiciones

⎇ 39cd0fcbbda7cd38cc6316e7339b1f3aed29e99f tests/generated/overflow_main_axis.rs Rust · 36 líneas · 1.4 KB Historia Quién tocó qué crudo

Rename `new_node` to `new_with_children` (#142) 5d00d8fb9 · Andreas Weibye ·

1#[test]
2fn overflow_main_axis() {
3    let mut taffy = taffy::Taffy::new();
4    let node0 = taffy
5        .new_with_children(
6            taffy::style::FlexboxLayout {
7                flex_shrink: 0f32,
8                size: taffy::geometry::Size { width: taffy::style::Dimension::Points(200f32), ..Default::default() },
9                ..Default::default()
10            },
11            &[],
12        )
13        .unwrap();
14    let node = taffy
15        .new_with_children(
16            taffy::style::FlexboxLayout {
17                size: taffy::geometry::Size {
18                    width: taffy::style::Dimension::Points(100f32),
19                    height: taffy::style::Dimension::Points(100f32),
20                    ..Default::default()
21                },
22                ..Default::default()
23            },
24            &[node0],
25        )
26        .unwrap();
27    taffy.compute_layout(node, taffy::geometry::Size::undefined()).unwrap();
28    assert_eq!(taffy.layout(node).unwrap().size.width, 100f32);
29    assert_eq!(taffy.layout(node).unwrap().size.height, 100f32);
30    assert_eq!(taffy.layout(node).unwrap().location.x, 0f32);
31    assert_eq!(taffy.layout(node).unwrap().location.y, 0f32);
32    assert_eq!(taffy.layout(node0).unwrap().size.width, 200f32);
33    assert_eq!(taffy.layout(node0).unwrap().size.height, 100f32);
34    assert_eq!(taffy.layout(node0).unwrap().location.x, 0f32);
35    assert_eq!(taffy.layout(node0).unwrap().location.y, 0f32);
36}