⎇ 9e53f03adea2b770d68954e404d2fa407dfc7d40
tests/generated/gap_row_gap_align_items_stretch.rs
Ñawpa willay
Pi imata llamkarqan
ch'uya
Implement "gap" property for flexbox algorithm (#248)
1#[test]
2fn gap_row_gap_align_items_stretch() {
3 let mut taffy = taffy::Taffy::new();
4 let node0 = taffy
5 .new_with_children(
6 taffy::style::FlexboxLayout {
7 size: taffy::geometry::Size { width: taffy::style::Dimension::Points(20f32), ..Default::default() },
8 ..Default::default()
9 },
10 &[],
11 )
12 .unwrap();
13 let node1 = taffy
14 .new_with_children(
15 taffy::style::FlexboxLayout {
16 size: taffy::geometry::Size { width: taffy::style::Dimension::Points(20f32), ..Default::default() },
17 ..Default::default()
18 },
19 &[],
20 )
21 .unwrap();
22 let node2 = taffy
23 .new_with_children(
24 taffy::style::FlexboxLayout {
25 size: taffy::geometry::Size { width: taffy::style::Dimension::Points(20f32), ..Default::default() },
26 ..Default::default()
27 },
28 &[],
29 )
30 .unwrap();
31 let node3 = taffy
32 .new_with_children(
33 taffy::style::FlexboxLayout {
34 size: taffy::geometry::Size { width: taffy::style::Dimension::Points(20f32), ..Default::default() },
35 ..Default::default()
36 },
37 &[],
38 )
39 .unwrap();
40 let node4 = taffy
41 .new_with_children(
42 taffy::style::FlexboxLayout {
43 size: taffy::geometry::Size { width: taffy::style::Dimension::Points(20f32), ..Default::default() },
44 ..Default::default()
45 },
46 &[],
47 )
48 .unwrap();
49 let node5 = taffy
50 .new_with_children(
51 taffy::style::FlexboxLayout {
52 size: taffy::geometry::Size { width: taffy::style::Dimension::Points(20f32), ..Default::default() },
53 ..Default::default()
54 },
55 &[],
56 )
57 .unwrap();
58 let node = taffy
59 .new_with_children(
60 taffy::style::FlexboxLayout {
61 flex_wrap: taffy::style::FlexWrap::Wrap,
62 gap: taffy::geometry::Size {
63 width: taffy::style::Dimension::Points(10f32),
64 height: taffy::style::Dimension::Points(20f32),
65 ..Default::default()
66 },
67 size: taffy::geometry::Size {
68 width: taffy::style::Dimension::Points(100f32),
69 height: taffy::style::Dimension::Points(200f32),
70 ..Default::default()
71 },
72 ..Default::default()
73 },
74 &[node0, node1, node2, node3, node4, node5],
75 )
76 .unwrap();
77 taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
78 assert_eq!(taffy.layout(node).unwrap().size.width, 100f32);
79 assert_eq!(taffy.layout(node).unwrap().size.height, 200f32);
80 assert_eq!(taffy.layout(node).unwrap().location.x, 0f32);
81 assert_eq!(taffy.layout(node).unwrap().location.y, 0f32);
82 assert_eq!(taffy.layout(node0).unwrap().size.width, 20f32);
83 assert_eq!(taffy.layout(node0).unwrap().size.height, 90f32);
84 assert_eq!(taffy.layout(node0).unwrap().location.x, 0f32);
85 assert_eq!(taffy.layout(node0).unwrap().location.y, 0f32);
86 assert_eq!(taffy.layout(node1).unwrap().size.width, 20f32);
87 assert_eq!(taffy.layout(node1).unwrap().size.height, 90f32);
88 assert_eq!(taffy.layout(node1).unwrap().location.x, 30f32);
89 assert_eq!(taffy.layout(node1).unwrap().location.y, 0f32);
90 assert_eq!(taffy.layout(node2).unwrap().size.width, 20f32);
91 assert_eq!(taffy.layout(node2).unwrap().size.height, 90f32);
92 assert_eq!(taffy.layout(node2).unwrap().location.x, 60f32);
93 assert_eq!(taffy.layout(node2).unwrap().location.y, 0f32);
94 assert_eq!(taffy.layout(node3).unwrap().size.width, 20f32);
95 assert_eq!(taffy.layout(node3).unwrap().size.height, 90f32);
96 assert_eq!(taffy.layout(node3).unwrap().location.x, 0f32);
97 assert_eq!(taffy.layout(node3).unwrap().location.y, 110f32);
98 assert_eq!(taffy.layout(node4).unwrap().size.width, 20f32);
99 assert_eq!(taffy.layout(node4).unwrap().size.height, 90f32);
100 assert_eq!(taffy.layout(node4).unwrap().location.x, 30f32);
101 assert_eq!(taffy.layout(node4).unwrap().location.y, 110f32);
102 assert_eq!(taffy.layout(node5).unwrap().size.width, 20f32);
103 assert_eq!(taffy.layout(node5).unwrap().size.height, 90f32);
104 assert_eq!(taffy.layout(node5).unwrap().location.x, 60f32);
105 assert_eq!(taffy.layout(node5).unwrap().location.y, 110f32);
106}