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