tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

HTML 5334Rust 85Markdown 12TOML 91813 Sutichaykuna

⎇ bf3dfaec9e387a7e67408fc78ca869d7eaaa8e1f benches/generated/justify_content_column_min_height_and_margin.rs Rust · 33 siq'ikuna · 1.3 KB Ñawpa willay Pi imata llamkarqan ch'uya

Fix justify content with margin tests (#329) b0c7d824d · Nico Burns ·

1pub fn compute() {
2    #[allow(unused_imports)]
3    use taffy::prelude::*;
4    let mut taffy = taffy::Taffy::new();
5    let node00 = taffy
6        .new_leaf(taffy::style::Style {
7            size: taffy::geometry::Size {
8                width: taffy::style::Dimension::Points(20f32),
9                height: taffy::style::Dimension::Points(20f32),
10            },
11            ..Default::default()
12        })
13        .unwrap();
14    let node0 = taffy
15        .new_with_children(
16            taffy::style::Style {
17                flex_direction: taffy::style::FlexDirection::Column,
18                justify_content: Some(taffy::style::JustifyContent::Center),
19                min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Points(50f32) },
20                margin: taffy::geometry::Rect {
21                    left: zero(),
22                    right: zero(),
23                    top: taffy::style::LengthPercentageAuto::Points(100f32),
24                    bottom: zero(),
25                },
26                ..Default::default()
27            },
28            &[node00],
29        )
30        .unwrap();
31    let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0]).unwrap();
32    taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
33}