⎇ 39cd0fcbbda7cd38cc6316e7339b1f3aed29e99f
tests/generated/justify_content_row_max_width_and_margin.rs
Historia
Quién tocó qué
crudo
Rename `new_node` to `new_with_children` (#142)
1#[test]
2fn justify_content_row_max_width_and_margin() {
3 let mut taffy = taffy::Taffy::new();
4 let node0 = taffy
5 .new_with_children(
6 taffy::style::FlexboxLayout {
7 size: taffy::geometry::Size {
8 width: taffy::style::Dimension::Points(20f32),
9 height: taffy::style::Dimension::Points(20f32),
10 ..Default::default()
11 },
12 margin: taffy::geometry::Rect { start: taffy::style::Dimension::Points(100f32), ..Default::default() },
13 ..Default::default()
14 },
15 &[],
16 )
17 .unwrap();
18 let node = taffy
19 .new_with_children(
20 taffy::style::FlexboxLayout {
21 justify_content: taffy::style::JustifyContent::Center,
22 size: taffy::geometry::Size { width: taffy::style::Dimension::Points(100f32), ..Default::default() },
23 max_size: taffy::geometry::Size { width: taffy::style::Dimension::Points(80f32), ..Default::default() },
24 ..Default::default()
25 },
26 &[node0],
27 )
28 .unwrap();
29 taffy.compute_layout(node, taffy::geometry::Size::undefined()).unwrap();
30 assert_eq!(taffy.layout(node).unwrap().size.width, 80f32);
31 assert_eq!(taffy.layout(node).unwrap().size.height, 20f32);
32 assert_eq!(taffy.layout(node).unwrap().location.x, 0f32);
33 assert_eq!(taffy.layout(node).unwrap().location.y, 0f32);
34 assert_eq!(taffy.layout(node0).unwrap().size.width, 0f32);
35 assert_eq!(taffy.layout(node0).unwrap().size.height, 20f32);
36 assert_eq!(taffy.layout(node0).unwrap().location.x, 90f32);
37 assert_eq!(taffy.layout(node0).unwrap().location.y, 0f32);
38}