⎇ 48e4800f14c6af5cd26275fb570d11b93e279654
tests/generated/flex/rounding_inner_node_controversy_vertical.rs
Ñawpa willay
Pi imata llamkarqan
ch'uya
Sort test fixtures and generated tests into folders (#514)
1#[test]
2fn rounding_inner_node_controversy_vertical() {
3 #[allow(unused_imports)]
4 use taffy::{prelude::*, tree::Layout};
5 let mut taffy = taffy::Taffy::new();
6 let node0 = taffy
7 .new_leaf(taffy::style::Style {
8 flex_grow: 1f32,
9 size: taffy::geometry::Size { width: taffy::style::Dimension::Length(10f32), height: auto() },
10 ..Default::default()
11 })
12 .unwrap();
13 let node10 = taffy
14 .new_leaf(taffy::style::Style {
15 flex_grow: 1f32,
16 size: taffy::geometry::Size { width: taffy::style::Dimension::Length(10f32), height: auto() },
17 ..Default::default()
18 })
19 .unwrap();
20 let node1 = taffy
21 .new_with_children(
22 taffy::style::Style {
23 flex_direction: taffy::style::FlexDirection::Column,
24 flex_grow: 1f32,
25 size: taffy::geometry::Size { width: taffy::style::Dimension::Length(10f32), height: auto() },
26 ..Default::default()
27 },
28 &[node10],
29 )
30 .unwrap();
31 let node2 = taffy
32 .new_leaf(taffy::style::Style {
33 flex_grow: 1f32,
34 size: taffy::geometry::Size { width: taffy::style::Dimension::Length(10f32), height: auto() },
35 ..Default::default()
36 })
37 .unwrap();
38 let node = taffy
39 .new_with_children(
40 taffy::style::Style {
41 flex_direction: taffy::style::FlexDirection::Column,
42 size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(320f32) },
43 ..Default::default()
44 },
45 &[node0, node1, node2],
46 )
47 .unwrap();
48 taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
49 println!("\nComputed tree:");
50 taffy::util::print_tree(&taffy, node);
51 println!();
52 let Layout { size, location, .. } = taffy.layout(node).unwrap();
53 assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node, 10f32, size.width);
54 assert_eq!(size.height, 320f32, "height of node {:?}. Expected {}. Actual {}", node, 320f32, size.height);
55 assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x);
56 assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y);
57 let Layout { size, location, .. } = taffy.layout(node0).unwrap();
58 assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width);
59 assert_eq!(size.height, 107f32, "height of node {:?}. Expected {}. Actual {}", node0, 107f32, size.height);
60 assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x);
61 assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y);
62 let Layout { size, location, .. } = taffy.layout(node1).unwrap();
63 assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node1, 10f32, size.width);
64 assert_eq!(size.height, 106f32, "height of node {:?}. Expected {}. Actual {}", node1, 106f32, size.height);
65 assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x);
66 assert_eq!(location.y, 107f32, "y of node {:?}. Expected {}. Actual {}", node1, 107f32, location.y);
67 let Layout { size, location, .. } = taffy.layout(node10).unwrap();
68 assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node10, 10f32, size.width);
69 assert_eq!(size.height, 106f32, "height of node {:?}. Expected {}. Actual {}", node10, 106f32, size.height);
70 assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x);
71 assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y);
72 let Layout { size, location, .. } = taffy.layout(node2).unwrap();
73 assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node2, 10f32, size.width);
74 assert_eq!(size.height, 107f32, "height of node {:?}. Expected {}. Actual {}", node2, 107f32, size.height);
75 assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x);
76 assert_eq!(location.y, 213f32, "y of node {:?}. Expected {}. Actual {}", node2, 213f32, location.y);
77}