⎇ 568f643327ec6b4879df0087def7f4e66b6acafb
tests/generated/leaf_overflow_scrollbars_overriden_by_size.rs
Historia
Quién tocó qué
crudo
Support `Overflow::Scroll` (#446)
1#[test]
2fn leaf_overflow_scrollbars_overriden_by_size() {
3 #[allow(unused_imports)]
4 use taffy::{prelude::*, tree::Layout};
5 let mut taffy = taffy::Taffy::new();
6 let node = taffy
7 .new_leaf(taffy::style::Style {
8 overflow: taffy::geometry::Point { x: taffy::style::Overflow::Scroll, y: taffy::style::Overflow::Scroll },
9 scrollbar_width: 15f32,
10 size: taffy::geometry::Size {
11 width: taffy::style::Dimension::Length(2f32),
12 height: taffy::style::Dimension::Length(4f32),
13 },
14 ..Default::default()
15 })
16 .unwrap();
17 taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
18 println!("\nComputed tree:");
19 taffy::util::print_tree(&taffy, node);
20 println!();
21 let Layout { size, location, .. } = taffy.layout(node).unwrap();
22 assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node, 2f32, size.width);
23 assert_eq!(size.height, 4f32, "height of node {:?}. Expected {}. Actual {}", node, 4f32, 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}