⎇ a9acf58cd4179aba3230ea7abd27003dc445c034
tests/generated/wrap_nodes_with_content_sizing_overflowing_margin.rs
Historia
Quién tocó qué
crudo
[gentest] Refactor gentest to use WebDriver & quote crate.
1#[test]
2fn wrap_nodes_with_content_sizing_overflowing_margin() {
3 let layout = stretch::compute(
4 &stretch::style::Node {
5 flex_direction: stretch::style::FlexDirection::Column,
6 size: stretch::geometry::Size {
7 width: stretch::style::Dimension::Points(500f32),
8 height: stretch::style::Dimension::Points(500f32),
9 ..Default::default()
10 },
11 children: vec![stretch::style::Node {
12 flex_wrap: stretch::style::FlexWrap::Wrap,
13 size: stretch::geometry::Size { width: stretch::style::Dimension::Points(85f32), ..Default::default() },
14 children: vec![
15 stretch::style::Node {
16 flex_direction: stretch::style::FlexDirection::Column,
17 children: vec![stretch::style::Node {
18 size: stretch::geometry::Size {
19 width: stretch::style::Dimension::Points(40f32),
20 height: stretch::style::Dimension::Points(40f32),
21 ..Default::default()
22 },
23 ..Default::default()
24 }],
25 ..Default::default()
26 },
27 stretch::style::Node {
28 flex_direction: stretch::style::FlexDirection::Column,
29 children: vec![stretch::style::Node {
30 size: stretch::geometry::Size {
31 width: stretch::style::Dimension::Points(40f32),
32 height: stretch::style::Dimension::Points(40f32),
33 ..Default::default()
34 },
35 ..Default::default()
36 }],
37 margin: stretch::geometry::Rect {
38 end: stretch::style::Dimension::Points(10f32),
39 ..Default::default()
40 },
41 ..Default::default()
42 },
43 ],
44 ..Default::default()
45 }],
46 ..Default::default()
47 },
48 stretch::geometry::Size::undefined(),
49 )
50 .unwrap();
51 assert_eq!(layout.size.width, 500f32);
52 assert_eq!(layout.size.height, 500f32);
53 assert_eq!(layout.location.x, 0f32);
54 assert_eq!(layout.location.y, 0f32);
55 assert_eq!(layout.children[0usize].size.width, 85f32);
56 assert_eq!(layout.children[0usize].size.height, 80f32);
57 assert_eq!(layout.children[0usize].location.x, 0f32);
58 assert_eq!(layout.children[0usize].location.y, 0f32);
59 assert_eq!(layout.children[0usize].children[0usize].size.width, 40f32);
60 assert_eq!(layout.children[0usize].children[0usize].size.height, 40f32);
61 assert_eq!(layout.children[0usize].children[0usize].location.x, 0f32);
62 assert_eq!(layout.children[0usize].children[0usize].location.y, 0f32);
63 assert_eq!(layout.children[0usize].children[0usize].children[0usize].size.width, 40f32);
64 assert_eq!(layout.children[0usize].children[0usize].children[0usize].size.height, 40f32);
65 assert_eq!(layout.children[0usize].children[0usize].children[0usize].location.x, 0f32);
66 assert_eq!(layout.children[0usize].children[0usize].children[0usize].location.y, 0f32);
67 assert_eq!(layout.children[0usize].children[1usize].size.width, 40f32);
68 assert_eq!(layout.children[0usize].children[1usize].size.height, 40f32);
69 assert_eq!(layout.children[0usize].children[1usize].location.x, 0f32);
70 assert_eq!(layout.children[0usize].children[1usize].location.y, 40f32);
71 assert_eq!(layout.children[0usize].children[1usize].children[0usize].size.width, 40f32);
72 assert_eq!(layout.children[0usize].children[1usize].children[0usize].size.height, 40f32);
73 assert_eq!(layout.children[0usize].children[1usize].children[0usize].location.x, 0f32);
74 assert_eq!(layout.children[0usize].children[1usize].children[0usize].location.y, 0f32);
75}