gioser

tawasuyu/taffy

A high performance rust-powered UI layout library

HTML 227Rust 7TOML 3CSS 1307 Definitions

⎇ 6652882a96948b4d8ee433a176d428cf3c3916bf benches/generated/measure_remeasure_child_after_stretching.rs Rust · 27 lines · 947 B History Who touched what raw

Convert measure tests to gentests (#292) 6652882a9 · Nico Burns ·

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 { ..Default::default() },
8            taffy::node::MeasureFunc::Raw(|known_dimensions, available_space| {
9                const TEXT: &str = "HH";
10                super::measure_standard_text(known_dimensions, available_space, TEXT)
11            }),
12        )
13        .unwrap();
14    let node = taffy
15        .new_with_children(
16            taffy::style::Style {
17                size: taffy::geometry::Size {
18                    width: taffy::style::Dimension::Points(100f32),
19                    height: taffy::style::Dimension::Points(100f32),
20                },
21                ..Default::default()
22            },
23            &[node0],
24        )
25        .unwrap();
26    taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
27}