⎇ 4e1c35c5d40729fdaafc40afeea863aa12ed1d5a
benches/generated/aspect_ratio_flex_column_fill_min_width.rs
History
Who touched what
raw
Fixes for aspect ratio and min/max sizes (#317)
1pub fn compute() {
2 #[allow(unused_imports)]
3 use taffy::prelude::*;
4 let mut taffy = taffy::Taffy::new();
5 let node0 = taffy
6 .new_leaf_with_measure(
7 taffy::style::Style {
8 min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Points(40f32) },
9 aspect_ratio: Some(2f32),
10 ..Default::default()
11 },
12 taffy::node::MeasureFunc::Raw(|known_dimensions, available_space| {
13 const TEXT: &str = "\n \n ";
14 super::measure_standard_text(
15 known_dimensions,
16 available_space,
17 TEXT,
18 super::WritingMode::Horizontal,
19 Some(2f32),
20 )
21 }),
22 )
23 .unwrap();
24 let node = taffy
25 .new_with_children(
26 taffy::style::Style {
27 display: taffy::style::Display::Flex,
28 flex_direction: taffy::style::FlexDirection::Column,
29 align_items: Some(taffy::style::AlignItems::Start),
30 size: taffy::geometry::Size {
31 width: taffy::style::Dimension::Points(100f32),
32 height: taffy::style::Dimension::Points(100f32),
33 },
34 ..Default::default()
35 },
36 &[node0],
37 )
38 .unwrap();
39 taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
40}