tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 717HTML 669Markdown 12TOML 62373 Definitions

⎇ a9acf58cd4179aba3230ea7abd27003dc445c034 tests/generated/flex_grow_within_constrained_max_column.rs Rust · 42 lines · 1.7 KB History Who touched what raw

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

1#[test]
2fn flex_grow_within_constrained_max_column() {
3    let layout = stretch::compute(
4        &stretch::style::Node {
5            flex_direction: stretch::style::FlexDirection::Column,
6            size: stretch::geometry::Size { width: stretch::style::Dimension::Points(100f32), ..Default::default() },
7            max_size: stretch::geometry::Size {
8                height: stretch::style::Dimension::Points(100f32),
9                ..Default::default()
10            },
11            children: vec![
12                stretch::style::Node {
13                    flex_shrink: 1f32,
14                    flex_basis: stretch::style::Dimension::Points(100f32),
15                    ..Default::default()
16                },
17                stretch::style::Node {
18                    size: stretch::geometry::Size {
19                        height: stretch::style::Dimension::Points(50f32),
20                        ..Default::default()
21                    },
22                    ..Default::default()
23                },
24            ],
25            ..Default::default()
26        },
27        stretch::geometry::Size::undefined(),
28    )
29    .unwrap();
30    assert_eq!(layout.size.width, 100f32);
31    assert_eq!(layout.size.height, 100f32);
32    assert_eq!(layout.location.x, 0f32);
33    assert_eq!(layout.location.y, 0f32);
34    assert_eq!(layout.children[0usize].size.width, 100f32);
35    assert_eq!(layout.children[0usize].size.height, 67f32);
36    assert_eq!(layout.children[0usize].location.x, 0f32);
37    assert_eq!(layout.children[0usize].location.y, 0f32);
38    assert_eq!(layout.children[1usize].size.width, 100f32);
39    assert_eq!(layout.children[1usize].size.height, 33f32);
40    assert_eq!(layout.children[1usize].location.x, 0f32);
41    assert_eq!(layout.children[1usize].location.y, 67f32);
42}