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