⎇ a1e91740880b61f1c39c9114b628ff09655141a9
tests/generated/absolute_layout_width_height_start_top_end_bottom.rs
Historia
Quién tocó qué
crudo
1#[test]
2fn absolute_layout_width_height_start_top_end_bottom() {
3 let mut sprawl = sprawl::Sprawl::new();
4 let node0 = sprawl
5 .new_node(
6 sprawl::style::Style {
7 position_type: sprawl::style::PositionType::Absolute,
8 size: sprawl::geometry::Size {
9 width: sprawl::style::Dimension::Points(10f32),
10 height: sprawl::style::Dimension::Points(10f32),
11 ..Default::default()
12 },
13 position: sprawl::geometry::Rect {
14 start: sprawl::style::Dimension::Points(10f32),
15 end: sprawl::style::Dimension::Points(10f32),
16 top: sprawl::style::Dimension::Points(10f32),
17 bottom: sprawl::style::Dimension::Points(10f32),
18 ..Default::default()
19 },
20 ..Default::default()
21 },
22 &[],
23 )
24 .unwrap();
25 let node = sprawl
26 .new_node(
27 sprawl::style::Style {
28 size: sprawl::geometry::Size {
29 width: sprawl::style::Dimension::Points(100f32),
30 height: sprawl::style::Dimension::Points(100f32),
31 ..Default::default()
32 },
33 ..Default::default()
34 },
35 &[node0],
36 )
37 .unwrap();
38 sprawl.compute_layout(node, sprawl::geometry::Size::undefined()).unwrap();
39 assert_eq!(sprawl.layout(node).unwrap().size.width, 100f32);
40 assert_eq!(sprawl.layout(node).unwrap().size.height, 100f32);
41 assert_eq!(sprawl.layout(node).unwrap().location.x, 0f32);
42 assert_eq!(sprawl.layout(node).unwrap().location.y, 0f32);
43 assert_eq!(sprawl.layout(node0).unwrap().size.width, 10f32);
44 assert_eq!(sprawl.layout(node0).unwrap().size.height, 10f32);
45 assert_eq!(sprawl.layout(node0).unwrap().location.x, 10f32);
46 assert_eq!(sprawl.layout(node0).unwrap().location.y, 10f32);
47}