⎇ b9fce82ccc823839f673144ed08f2e0e53f52b76
tests/generated/grid_span_2_max_content_auto_indefinite_hidden.rs
Historia
Quién tocó qué
crudo
Support `Overflow::Hidden` (#424)
1#[test]
2fn grid_span_2_max_content_auto_indefinite_hidden() {
3 use slotmap::Key;
4 #[allow(unused_imports)]
5 use taffy::{layout::Layout, prelude::*};
6 let mut taffy = taffy::Taffy::new();
7 let node0 = taffy
8 .new_leaf(taffy::style::Style {
9 grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto },
10 grid_column: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto },
11 ..Default::default()
12 })
13 .unwrap();
14 let node1 = taffy
15 .new_leaf(taffy::style::Style {
16 grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto },
17 grid_column: taffy::geometry::Line { start: line(2i16), end: taffy::style::GridPlacement::Auto },
18 ..Default::default()
19 })
20 .unwrap();
21 let node = taffy
22 .new_with_children(
23 taffy::style::Style {
24 display: taffy::style::Display::Grid,
25 grid_template_rows: vec![points(40f32)],
26 grid_template_columns: vec![max_content(), auto()],
27 ..Default::default()
28 },
29 &[node0, node1],
30 )
31 .unwrap();
32 taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
33 println!("\nComputed tree:");
34 taffy::debug::print_tree(&taffy, node);
35 println!();
36 let Layout { size, location, .. } = taffy.layout(node).unwrap();
37 assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node.data(), 0f32, size.width);
38 assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node.data(), 40f32, size.height);
39 assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node.data(), 0f32, location.x);
40 assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node.data(), 0f32, location.y);
41 let Layout { size, location, .. } = taffy.layout(node0).unwrap();
42 assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0.data(), 0f32, size.width);
43 assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0.data(), 40f32, size.height);
44 assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0.data(), 0f32, location.x);
45 assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0.data(), 0f32, location.y);
46 let Layout { size, location, .. } = taffy.layout(node1).unwrap();
47 assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1.data(), 0f32, size.width);
48 assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1.data(), 40f32, size.height);
49 assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1.data(), 0f32, location.x);
50 assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1.data(), 0f32, location.y);
51}