⎇ c154b8aa719da0d6f8636b123765a47fa40a3306
tests/generated/flex/display_none_only_node.rs
Ñawpa willay
Pi imata llamkarqan
ch'uya
Rename Taffy struct to TaffyTree (#580)
1#[test]
2fn display_none_only_node() {
3 #[allow(unused_imports)]
4 use taffy::{prelude::*, tree::Layout, TaffyTree};
5 let mut taffy: TaffyTree<crate::TextMeasure> = TaffyTree::new();
6 let node = taffy
7 .new_leaf(taffy::style::Style {
8 display: taffy::style::Display::None,
9 size: taffy::geometry::Size {
10 width: taffy::style::Dimension::Length(100f32),
11 height: taffy::style::Dimension::Length(100f32),
12 },
13 ..Default::default()
14 })
15 .unwrap();
16 taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap();
17 println!("\nComputed tree:");
18 taffy.print_tree(node);
19 println!();
20 #[cfg_attr(not(feature = "content_size"), allow(unused_variables))]
21 let layout @ Layout { size, location, .. } = taffy.layout(node).unwrap();
22 assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width);
23 assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node, 0f32, size.height);
24 assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x);
25 assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y);
26 #[cfg(feature = "content_size")]
27 assert_eq!(
28 layout.scroll_width(),
29 0f32,
30 "scroll_width of node {:?}. Expected {}. Actual {}",
31 node,
32 0f32,
33 layout.scroll_width()
34 );
35 #[cfg(feature = "content_size")]
36 assert_eq!(
37 layout.scroll_height(),
38 0f32,
39 "scroll_height of node {:?}. Expected {}. Actual {}",
40 node,
41 0f32,
42 layout.scroll_height()
43 );
44}