⎇ c154b8aa719da0d6f8636b123765a47fa40a3306
tests/generated/flex/min_height_overrides_height.rs
Historia
Quién tocó qué
crudo
Rename Taffy struct to TaffyTree (#580)
1#[test]
2fn min_height_overrides_height() {
3 #[allow(unused_imports)]
4 use taffy::{prelude::*, tree::Layout, TaffyTree};
5 let mut taffy: TaffyTree<crate::TextMeasure> = TaffyTree::new();
6 let node0 = taffy
7 .new_leaf(taffy::style::Style {
8 size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(50f32) },
9 min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(100f32) },
10 ..Default::default()
11 })
12 .unwrap();
13 let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0]).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 #[cfg_attr(not(feature = "content_size"), allow(unused_variables))]
19 let layout @ Layout { size, location, .. } = taffy.layout(node).unwrap();
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 #[cfg(feature = "content_size")]
25 assert_eq!(
26 layout.scroll_width(),
27 0f32,
28 "scroll_width of node {:?}. Expected {}. Actual {}",
29 node,
30 0f32,
31 layout.scroll_width()
32 );
33 #[cfg(feature = "content_size")]
34 assert_eq!(
35 layout.scroll_height(),
36 0f32,
37 "scroll_height of node {:?}. Expected {}. Actual {}",
38 node,
39 0f32,
40 layout.scroll_height()
41 );
42 #[cfg_attr(not(feature = "content_size"), allow(unused_variables))]
43 let layout @ Layout { size, location, .. } = taffy.layout(node0).unwrap();
44 assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width);
45 assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height);
46 assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x);
47 assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y);
48 #[cfg(feature = "content_size")]
49 assert_eq!(
50 layout.scroll_width(),
51 0f32,
52 "scroll_width of node {:?}. Expected {}. Actual {}",
53 node0,
54 0f32,
55 layout.scroll_width()
56 );
57 #[cfg(feature = "content_size")]
58 assert_eq!(
59 layout.scroll_height(),
60 0f32,
61 "scroll_height of node {:?}. Expected {}. Actual {}",
62 node0,
63 0f32,
64 layout.scroll_height()
65 );
66}