tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 501HTML 254C 19JavaScript 81412 Definitions

⎇ a9acf58cd4179aba3230ea7abd27003dc445c034 tests/generated/flex_basis_flex_grow_column.rs Rust · 36 lines · 1.5 KB History Who touched what raw

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

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