⎇ float-layout
tests/generated/flex/min_height_overrides_height_on_root.rs
Ñawpa willay
Pi imata llamkarqan
ch'uya
Use tagged pointer to represent size/length values (#769)
1#[test]
2#[allow(non_snake_case)]
3fn min_height_overrides_height_on_root__border_box() {
4 #[allow(unused_imports)]
5 use taffy::{prelude::*, Layout};
6 let mut taffy = crate::new_test_tree();
7 let node = taffy
8 .new_leaf(taffy::style::Style {
9 size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) },
10 min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) },
11 ..Default::default()
12 })
13 .unwrap();
14 taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap();
15 println!("\nComputed tree:");
16 taffy.print_tree(node);
17 println!();
18 let layout = taffy.layout(node).unwrap();
19 let Layout { size, location, .. } = layout;
20 assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width);
21 assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height);
22 assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x);
23 assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y);
24}
25
26#[test]
27#[allow(non_snake_case)]
28fn min_height_overrides_height_on_root__content_box() {
29 #[allow(unused_imports)]
30 use taffy::{prelude::*, Layout};
31 let mut taffy = crate::new_test_tree();
32 let node = taffy
33 .new_leaf(taffy::style::Style {
34 box_sizing: taffy::style::BoxSizing::ContentBox,
35 size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) },
36 min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) },
37 ..Default::default()
38 })
39 .unwrap();
40 taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap();
41 println!("\nComputed tree:");
42 taffy.print_tree(node);
43 println!();
44 let layout = taffy.layout(node).unwrap();
45 let Layout { size, location, .. } = layout;
46 assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width);
47 assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height);
48 assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x);
49 assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y);
50}