Rename Rect field start->left end->right (#257)
1#[test]
2fn display_none_with_margin() {
3 let mut taffy = taffy::Taffy::new();
4 let node0 = taffy
5 .new_with_children(
6 taffy::style::Style {
7 display: taffy::style::Display::None,
8 size: taffy::geometry::Size {
9 width: taffy::style::Dimension::Points(20f32),
10 height: taffy::style::Dimension::Points(20f32),
11 ..Default::default()
12 },
13 margin: taffy::geometry::Rect {
14 left: taffy::style::Dimension::Points(10f32),
15 right: taffy::style::Dimension::Points(10f32),
16 top: taffy::style::Dimension::Points(10f32),
17 bottom: taffy::style::Dimension::Points(10f32),
18 ..Default::default()
19 },
20 ..Default::default()
21 },
22 &[],
23 )
24 .unwrap();
25 let node1 = taffy.new_with_children(taffy::style::Style { flex_grow: 1f32, ..Default::default() }, &[]).unwrap();
26 let node = taffy
27 .new_with_children(
28 taffy::style::Style {
29 size: taffy::geometry::Size {
30 width: taffy::style::Dimension::Points(100f32),
31 height: taffy::style::Dimension::Points(100f32),
32 ..Default::default()
33 },
34 ..Default::default()
35 },
36 &[node0, node1],
37 )
38 .unwrap();
39 taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
40 assert_eq!(taffy.layout(node).unwrap().size.width, 100f32);
41 assert_eq!(taffy.layout(node).unwrap().size.height, 100f32);
42 assert_eq!(taffy.layout(node).unwrap().location.x, 0f32);
43 assert_eq!(taffy.layout(node).unwrap().location.y, 0f32);
44 assert_eq!(taffy.layout(node0).unwrap().size.width, 0f32);
45 assert_eq!(taffy.layout(node0).unwrap().size.height, 0f32);
46 assert_eq!(taffy.layout(node0).unwrap().location.x, 0f32);
47 assert_eq!(taffy.layout(node0).unwrap().location.y, 0f32);
48 assert_eq!(taffy.layout(node1).unwrap().size.width, 100f32);
49 assert_eq!(taffy.layout(node1).unwrap().size.height, 100f32);
50 assert_eq!(taffy.layout(node1).unwrap().location.x, 0f32);
51 assert_eq!(taffy.layout(node1).unwrap().location.y, 0f32);
52}