gioser

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 501HTML 254C 19JavaScript 81414 Sutichaykuna

⎇ 0.2.x tests/generated/absolute_layout_no_size.rs Rust · 32 siq'ikuna · 1.3 KB Ñawpa willay Pi imata llamkarqan ch'uya

Rename FlexboxLayout back to Style (#251) 49893a7d9 · Nico Burns ·

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