tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 520HTML 244Markdown 7TOML 41339 Sutichaykuna

⎇ a9acf58cd4179aba3230ea7abd27003dc445c034 tests/generated/justify_content_row_max_width_and_margin.rs Rust · 33 siq'ikuna · 1.4 KB Ñawpa willay Pi imata llamkarqan ch'uya

[gentest] Refactor gentest to use WebDriver & quote crate. a9acf58cd · Adam Perry ·

1#[test]
2fn justify_content_row_max_width_and_margin() {
3    let layout = stretch::compute(
4        &stretch::style::Node {
5            justify_content: stretch::style::JustifyContent::Center,
6            size: stretch::geometry::Size { width: stretch::style::Dimension::Points(100f32), ..Default::default() },
7            max_size: stretch::geometry::Size { width: stretch::style::Dimension::Points(80f32), ..Default::default() },
8            children: vec![stretch::style::Node {
9                size: stretch::geometry::Size {
10                    width: stretch::style::Dimension::Points(20f32),
11                    height: stretch::style::Dimension::Points(20f32),
12                    ..Default::default()
13                },
14                margin: stretch::geometry::Rect {
15                    start: stretch::style::Dimension::Points(100f32),
16                    ..Default::default()
17                },
18                ..Default::default()
19            }],
20            ..Default::default()
21        },
22        stretch::geometry::Size::undefined(),
23    )
24    .unwrap();
25    assert_eq!(layout.size.width, 80f32);
26    assert_eq!(layout.size.height, 20f32);
27    assert_eq!(layout.location.x, 0f32);
28    assert_eq!(layout.location.y, 0f32);
29    assert_eq!(layout.children[0usize].size.width, 0f32);
30    assert_eq!(layout.children[0usize].size.height, 20f32);
31    assert_eq!(layout.children[0usize].location.x, 90f32);
32    assert_eq!(layout.children[0usize].location.y, 0f32);
33}