tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

⎇ bf3dfaec9e387a7e67408fc78ca869d7eaaa8e1f benches/generated/absolute_child_with_max_height.rs Rust · 45 líneas · 1.6 KB Historia Quién tocó qué crudo

Import yoga tests (#320) e05b9093d · 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(100f32),
9                height: taffy::style::Dimension::Points(30f32),
10            },
11            ..Default::default()
12        })
13        .unwrap();
14    let node0 = taffy
15        .new_with_children(
16            taffy::style::Style {
17                position: taffy::style::Position::Absolute,
18                flex_direction: taffy::style::FlexDirection::Column,
19                max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Points(100f32) },
20                inset: taffy::geometry::Rect {
21                    left: auto(),
22                    right: auto(),
23                    top: auto(),
24                    bottom: taffy::style::LengthPercentageAuto::Points(20f32),
25                },
26                ..Default::default()
27            },
28            &[node00],
29        )
30        .unwrap();
31    let node = taffy
32        .new_with_children(
33            taffy::style::Style {
34                flex_direction: taffy::style::FlexDirection::Column,
35                size: taffy::geometry::Size {
36                    width: taffy::style::Dimension::Points(100f32),
37                    height: taffy::style::Dimension::Points(200f32),
38                },
39                ..Default::default()
40            },
41            &[node0],
42        )
43        .unwrap();
44    taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
45}