⎇ f1e4edab96ee13f7d1fbc2536ac31633b0e620d6
tests/generated/flex/overflow_scrollbars_overridden_by_size.rs
Ñawpa willay
Pi imata llamkarqan
ch'uya
1#[test]
2fn overflow_scrollbars_overridden_by_size() {
3 #[allow(unused_imports)]
4 use taffy::{prelude::*, tree::Layout, TaffyTree};
5 let mut taffy: TaffyTree<crate::TextMeasure> = TaffyTree::new();
6 let node0 = taffy.new_leaf(taffy::style::Style { flex_grow: 1f32, ..Default::default() }).unwrap();
7 let node = taffy
8 .new_with_children(
9 taffy::style::Style {
10 overflow: taffy::geometry::Point {
11 x: taffy::style::Overflow::Scroll,
12 y: taffy::style::Overflow::Scroll,
13 },
14 scrollbar_width: 15f32,
15 size: taffy::geometry::Size {
16 width: taffy::style::Dimension::Length(2f32),
17 height: taffy::style::Dimension::Length(4f32),
18 },
19 ..Default::default()
20 },
21 &[node0],
22 )
23 .unwrap();
24 taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap();
25 println!("\nComputed tree:");
26 taffy.print_tree(node);
27 println!();
28 #[cfg_attr(not(feature = "content_size"), allow(unused_variables))]
29 let layout @ Layout { size, location, .. } = taffy.layout(node).unwrap();
30 assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node, 2f32, size.width);
31 assert_eq!(size.height, 4f32, "height of node {:?}. Expected {}. Actual {}", node, 4f32, size.height);
32 assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x);
33 assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y);
34 #[cfg(feature = "content_size")]
35 assert_eq!(
36 layout.scroll_width(),
37 0f32,
38 "scroll_width of node {:?}. Expected {}. Actual {}",
39 node,
40 0f32,
41 layout.scroll_width()
42 );
43 #[cfg(feature = "content_size")]
44 assert_eq!(
45 layout.scroll_height(),
46 0f32,
47 "scroll_height of node {:?}. Expected {}. Actual {}",
48 node,
49 0f32,
50 layout.scroll_height()
51 );
52 #[cfg_attr(not(feature = "content_size"), allow(unused_variables))]
53 let layout @ Layout { size, location, .. } = taffy.layout(node0).unwrap();
54 assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width);
55 assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height);
56 assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x);
57 assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y);
58 #[cfg(feature = "content_size")]
59 assert_eq!(
60 layout.scroll_width(),
61 0f32,
62 "scroll_width of node {:?}. Expected {}. Actual {}",
63 node0,
64 0f32,
65 layout.scroll_width()
66 );
67 #[cfg(feature = "content_size")]
68 assert_eq!(
69 layout.scroll_height(),
70 0f32,
71 "scroll_height of node {:?}. Expected {}. Actual {}",
72 node0,
73 0f32,
74 layout.scroll_height()
75 );
76}