⎇ 06471455e8cc93ab7ffee650a033ae7df8943611
tests/generated/flex_direction_column_no_height.rs
Historia
Quién tocó qué
crudo
1#[test]
2fn flex_direction_column_no_height() {
3 let mut stretch = stretch2::Stretch::new();
4 let node0 = stretch
5 .new_node(
6 stretch2::style::Style {
7 size: stretch2::geometry::Size {
8 height: stretch2::style::Dimension::Points(10f32),
9 ..Default::default()
10 },
11 ..Default::default()
12 },
13 &[],
14 )
15 .unwrap();
16 let node1 = stretch
17 .new_node(
18 stretch2::style::Style {
19 size: stretch2::geometry::Size {
20 height: stretch2::style::Dimension::Points(10f32),
21 ..Default::default()
22 },
23 ..Default::default()
24 },
25 &[],
26 )
27 .unwrap();
28 let node2 = stretch
29 .new_node(
30 stretch2::style::Style {
31 size: stretch2::geometry::Size {
32 height: stretch2::style::Dimension::Points(10f32),
33 ..Default::default()
34 },
35 ..Default::default()
36 },
37 &[],
38 )
39 .unwrap();
40 let node = stretch
41 .new_node(
42 stretch2::style::Style {
43 flex_direction: stretch2::style::FlexDirection::Column,
44 size: stretch2::geometry::Size {
45 width: stretch2::style::Dimension::Points(100f32),
46 ..Default::default()
47 },
48 ..Default::default()
49 },
50 &[node0, node1, node2],
51 )
52 .unwrap();
53 stretch.compute_layout(node, stretch2::geometry::Size::undefined()).unwrap();
54 assert_eq!(stretch.layout(node).unwrap().size.width, 100f32);
55 assert_eq!(stretch.layout(node).unwrap().size.height, 30f32);
56 assert_eq!(stretch.layout(node).unwrap().location.x, 0f32);
57 assert_eq!(stretch.layout(node).unwrap().location.y, 0f32);
58 assert_eq!(stretch.layout(node0).unwrap().size.width, 100f32);
59 assert_eq!(stretch.layout(node0).unwrap().size.height, 10f32);
60 assert_eq!(stretch.layout(node0).unwrap().location.x, 0f32);
61 assert_eq!(stretch.layout(node0).unwrap().location.y, 0f32);
62 assert_eq!(stretch.layout(node1).unwrap().size.width, 100f32);
63 assert_eq!(stretch.layout(node1).unwrap().size.height, 10f32);
64 assert_eq!(stretch.layout(node1).unwrap().location.x, 0f32);
65 assert_eq!(stretch.layout(node1).unwrap().location.y, 10f32);
66 assert_eq!(stretch.layout(node2).unwrap().size.width, 100f32);
67 assert_eq!(stretch.layout(node2).unwrap().size.height, 10f32);
68 assert_eq!(stretch.layout(node2).unwrap().location.x, 0f32);
69 assert_eq!(stretch.layout(node2).unwrap().location.y, 20f32);
70}