⎇ 568f643327ec6b4879df0087def7f4e66b6acafb
tests/generated/align_items_stretch_min_cross.rs
History
Who touched what
raw
Rename `Points`/`points` to `Length`/`length` in many APIs (#459)
1#[test]
2fn align_items_stretch_min_cross() {
3 #[allow(unused_imports)]
4 use taffy::{prelude::*, tree::Layout};
5 let mut taffy = taffy::Taffy::new();
6 let node0 = taffy
7 .new_leaf(taffy::style::Style {
8 flex_shrink: 0f32,
9 size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(36f32) },
10 ..Default::default()
11 })
12 .unwrap();
13 let node = taffy
14 .new_with_children(
15 taffy::style::Style {
16 flex_direction: taffy::style::FlexDirection::Column,
17 min_size: taffy::geometry::Size {
18 width: taffy::style::Dimension::Length(400f32),
19 height: taffy::style::Dimension::Length(50f32),
20 },
21 ..Default::default()
22 },
23 &[node0],
24 )
25 .unwrap();
26 taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
27 println!("\nComputed tree:");
28 taffy::util::print_tree(&taffy, node);
29 println!();
30 let Layout { size, location, .. } = taffy.layout(node).unwrap();
31 assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width);
32 assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height);
33 assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x);
34 assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y);
35 let Layout { size, location, .. } = taffy.layout(node0).unwrap();
36 assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node0, 400f32, size.width);
37 assert_eq!(size.height, 36f32, "height of node {:?}. Expected {}. Actual {}", node0, 36f32, size.height);
38 assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x);
39 assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y);
40}