⎇ 06471455e8cc93ab7ffee650a033ae7df8943611
tests/generated/display_none_with_position.rs
Ñawpa willay
Pi imata llamkarqan
ch'uya
1#[test]
2fn display_none_with_position() {
3 let mut stretch = stretch2::Stretch::new();
4 let node0 = stretch.new_node(stretch2::style::Style { flex_grow: 1f32, ..Default::default() }, &[]).unwrap();
5 let node1 = stretch
6 .new_node(
7 stretch2::style::Style {
8 display: stretch2::style::Display::None,
9 flex_grow: 1f32,
10 position: stretch2::geometry::Rect {
11 top: stretch2::style::Dimension::Points(10f32),
12 ..Default::default()
13 },
14 ..Default::default()
15 },
16 &[],
17 )
18 .unwrap();
19 let node = stretch
20 .new_node(
21 stretch2::style::Style {
22 size: stretch2::geometry::Size {
23 width: stretch2::style::Dimension::Points(100f32),
24 height: stretch2::style::Dimension::Points(100f32),
25 ..Default::default()
26 },
27 ..Default::default()
28 },
29 &[node0, node1],
30 )
31 .unwrap();
32 stretch.compute_layout(node, stretch2::geometry::Size::undefined()).unwrap();
33 assert_eq!(stretch.layout(node).unwrap().size.width, 100f32);
34 assert_eq!(stretch.layout(node).unwrap().size.height, 100f32);
35 assert_eq!(stretch.layout(node).unwrap().location.x, 0f32);
36 assert_eq!(stretch.layout(node).unwrap().location.y, 0f32);
37 assert_eq!(stretch.layout(node0).unwrap().size.width, 100f32);
38 assert_eq!(stretch.layout(node0).unwrap().size.height, 100f32);
39 assert_eq!(stretch.layout(node0).unwrap().location.x, 0f32);
40 assert_eq!(stretch.layout(node0).unwrap().location.y, 0f32);
41 assert_eq!(stretch.layout(node1).unwrap().size.width, 0f32);
42 assert_eq!(stretch.layout(node1).unwrap().size.height, 0f32);
43 assert_eq!(stretch.layout(node1).unwrap().location.x, 0f32);
44 assert_eq!(stretch.layout(node1).unwrap().location.y, 0f32);
45}