⎇ 9e53f03adea2b770d68954e404d2fa407dfc7d40
tests/generated/wrapped_row_within_align_items_flex_start.rs
History
Who touched what
raw
Layout algorithm decoupling, Sizing Constraints & Perf Improvements (#246)
1#[test]
2fn wrapped_row_within_align_items_flex_start() {
3 let mut taffy = taffy::Taffy::new();
4 let node00 = taffy
5 .new_with_children(
6 taffy::style::FlexboxLayout {
7 size: taffy::geometry::Size {
8 width: taffy::style::Dimension::Points(150f32),
9 height: taffy::style::Dimension::Points(80f32),
10 ..Default::default()
11 },
12 ..Default::default()
13 },
14 &[],
15 )
16 .unwrap();
17 let node01 = taffy
18 .new_with_children(
19 taffy::style::FlexboxLayout {
20 size: taffy::geometry::Size {
21 width: taffy::style::Dimension::Points(80f32),
22 height: taffy::style::Dimension::Points(80f32),
23 ..Default::default()
24 },
25 ..Default::default()
26 },
27 &[],
28 )
29 .unwrap();
30 let node0 = taffy
31 .new_with_children(
32 taffy::style::FlexboxLayout { flex_wrap: taffy::style::FlexWrap::Wrap, ..Default::default() },
33 &[node00, node01],
34 )
35 .unwrap();
36 let node = taffy
37 .new_with_children(
38 taffy::style::FlexboxLayout {
39 flex_direction: taffy::style::FlexDirection::Column,
40 align_items: taffy::style::AlignItems::FlexStart,
41 size: taffy::geometry::Size {
42 width: taffy::style::Dimension::Points(200f32),
43 height: taffy::style::Dimension::Points(200f32),
44 ..Default::default()
45 },
46 ..Default::default()
47 },
48 &[node0],
49 )
50 .unwrap();
51 taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
52 assert_eq!(taffy.layout(node).unwrap().size.width, 200f32);
53 assert_eq!(taffy.layout(node).unwrap().size.height, 200f32);
54 assert_eq!(taffy.layout(node).unwrap().location.x, 0f32);
55 assert_eq!(taffy.layout(node).unwrap().location.y, 0f32);
56 assert_eq!(taffy.layout(node0).unwrap().size.width, 200f32);
57 assert_eq!(taffy.layout(node0).unwrap().size.height, 160f32);
58 assert_eq!(taffy.layout(node0).unwrap().location.x, 0f32);
59 assert_eq!(taffy.layout(node0).unwrap().location.y, 0f32);
60 assert_eq!(taffy.layout(node00).unwrap().size.width, 150f32);
61 assert_eq!(taffy.layout(node00).unwrap().size.height, 80f32);
62 assert_eq!(taffy.layout(node00).unwrap().location.x, 0f32);
63 assert_eq!(taffy.layout(node00).unwrap().location.y, 0f32);
64 assert_eq!(taffy.layout(node01).unwrap().size.width, 80f32);
65 assert_eq!(taffy.layout(node01).unwrap().size.height, 80f32);
66 assert_eq!(taffy.layout(node01).unwrap().location.x, 0f32);
67 assert_eq!(taffy.layout(node01).unwrap().location.y, 80f32);
68}