⎇ 837d03fde9d8a4efa0f4eaf1e8be2fd34a719a50
tests/generated/align_content_end_single_line_negative_space_gap.rs
Ñawpa willay
Pi imata llamkarqan
ch'uya
1#[test]
2fn align_content_end_single_line_negative_space_gap() {
3 use slotmap::Key;
4 #[allow(unused_imports)]
5 use taffy::{layout::Layout, prelude::*};
6 let mut taffy = taffy::Taffy::new();
7 let node00 = taffy
8 .new_leaf(taffy::style::Style {
9 flex_shrink: 0f32,
10 size: taffy::geometry::Size {
11 width: taffy::style::Dimension::Percent(0.8f32),
12 height: taffy::style::Dimension::Points(60f32),
13 },
14 ..Default::default()
15 })
16 .unwrap();
17 let node0 = taffy
18 .new_with_children(
19 taffy::style::Style {
20 display: taffy::style::Display::Flex,
21 align_content: Some(taffy::style::AlignContent::End),
22 justify_content: Some(taffy::style::JustifyContent::Center),
23 gap: taffy::geometry::Size {
24 width: taffy::style::LengthPercentage::Points(10f32),
25 height: taffy::style::LengthPercentage::Points(10f32),
26 },
27 size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Points(10f32) },
28 ..Default::default()
29 },
30 &[node00],
31 )
32 .unwrap();
33 let node = taffy
34 .new_with_children(
35 taffy::style::Style {
36 display: taffy::style::Display::Flex,
37 flex_direction: taffy::style::FlexDirection::Column,
38 size: taffy::geometry::Size {
39 width: taffy::style::Dimension::Points(320f32),
40 height: taffy::style::Dimension::Points(320f32),
41 },
42 border: taffy::geometry::Rect {
43 left: taffy::style::LengthPercentage::Points(60f32),
44 right: taffy::style::LengthPercentage::Points(60f32),
45 top: taffy::style::LengthPercentage::Points(60f32),
46 bottom: taffy::style::LengthPercentage::Points(60f32),
47 },
48 ..Default::default()
49 },
50 &[node0],
51 )
52 .unwrap();
53 taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
54 println!("\nComputed tree:");
55 taffy::debug::print_tree(&taffy, node);
56 println!();
57 let Layout { size, location, .. } = taffy.layout(node).unwrap();
58 assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node.data(), 320f32, size.width);
59 assert_eq!(size.height, 320f32, "height of node {:?}. Expected {}. Actual {}", node.data(), 320f32, size.height);
60 assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node.data(), 0f32, location.x);
61 assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node.data(), 0f32, location.y);
62 let Layout { size, location, .. } = taffy.layout(node0).unwrap();
63 assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0.data(), 200f32, size.width);
64 assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0.data(), 10f32, size.height);
65 assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0.data(), 60f32, location.x);
66 assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0.data(), 60f32, location.y);
67 let Layout { size, location, .. } = taffy.layout(node00).unwrap();
68 assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node00.data(), 160f32, size.width);
69 assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node00.data(), 60f32, size.height);
70 assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00.data(), 20f32, location.x);
71 assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00.data(), 0f32, location.y);
72}