⎇ 568f643327ec6b4879df0087def7f4e66b6acafb
tests/generated/grid_overflow_scrollbars_overriden_by_size.rs
History
Who touched what
raw
Support `Overflow::Scroll` (#446)
1#[test]
2fn grid_overflow_scrollbars_overriden_by_size() {
3 #[allow(unused_imports)]
4 use taffy::{prelude::*, tree::Layout};
5 let mut taffy = taffy::Taffy::new();
6 let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap();
7 let node = taffy
8 .new_with_children(
9 taffy::style::Style {
10 display: taffy::style::Display::Grid,
11 overflow: taffy::geometry::Point {
12 x: taffy::style::Overflow::Scroll,
13 y: taffy::style::Overflow::Scroll,
14 },
15 scrollbar_width: 15f32,
16 size: taffy::geometry::Size {
17 width: taffy::style::Dimension::Length(2f32),
18 height: taffy::style::Dimension::Length(4f32),
19 },
20 ..Default::default()
21 },
22 &[node0],
23 )
24 .unwrap();
25 taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
26 println!("\nComputed tree:");
27 taffy::util::print_tree(&taffy, node);
28 println!();
29 let 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 let Layout { size, location, .. } = taffy.layout(node0).unwrap();
35 assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width);
36 assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height);
37 assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x);
38 assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y);
39}