⎇ 48e4800f14c6af5cd26275fb570d11b93e279654
tests/generated/flex/justify_content_column_end.rs
Ñawpa willay
Pi imata llamkarqan
ch'uya
1#[test]
2fn justify_content_column_end() {
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 size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) },
9 ..Default::default()
10 })
11 .unwrap();
12 let node1 = taffy
13 .new_leaf(taffy::style::Style {
14 size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) },
15 ..Default::default()
16 })
17 .unwrap();
18 let node2 = taffy
19 .new_leaf(taffy::style::Style {
20 size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) },
21 ..Default::default()
22 })
23 .unwrap();
24 let node = taffy
25 .new_with_children(
26 taffy::style::Style {
27 flex_direction: taffy::style::FlexDirection::Column,
28 justify_content: Some(taffy::style::JustifyContent::FlexEnd),
29 size: taffy::geometry::Size {
30 width: taffy::style::Dimension::Length(100f32),
31 height: taffy::style::Dimension::Length(100f32),
32 },
33 ..Default::default()
34 },
35 &[node0, node1, node2],
36 )
37 .unwrap();
38 taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
39 println!("\nComputed tree:");
40 taffy::util::print_tree(&taffy, node);
41 println!();
42 let Layout { size, location, .. } = taffy.layout(node).unwrap();
43 assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width);
44 assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height);
45 assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x);
46 assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y);
47 let Layout { size, location, .. } = taffy.layout(node0).unwrap();
48 assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width);
49 assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height);
50 assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x);
51 assert_eq!(location.y, 70f32, "y of node {:?}. Expected {}. Actual {}", node0, 70f32, location.y);
52 let Layout { size, location, .. } = taffy.layout(node1).unwrap();
53 assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width);
54 assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height);
55 assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x);
56 assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node1, 80f32, location.y);
57 let Layout { size, location, .. } = taffy.layout(node2).unwrap();
58 assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width);
59 assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height);
60 assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x);
61 assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node2, 90f32, location.y);
62}