⎇ 9e53f03adea2b770d68954e404d2fa407dfc7d40
tests/generated/min_height.rs
Ñawpa willay
Pi imata llamkarqan
ch'uya
Layout algorithm decoupling, Sizing Constraints & Perf Improvements (#246)
1#[test]
2fn min_height() {
3 let mut taffy = taffy::Taffy::new();
4 let node0 = taffy
5 .new_with_children(
6 taffy::style::FlexboxLayout {
7 flex_grow: 1f32,
8 min_size: taffy::geometry::Size {
9 height: taffy::style::Dimension::Points(60f32),
10 ..Default::default()
11 },
12 ..Default::default()
13 },
14 &[],
15 )
16 .unwrap();
17 let node1 =
18 taffy.new_with_children(taffy::style::FlexboxLayout { flex_grow: 1f32, ..Default::default() }, &[]).unwrap();
19 let node = taffy
20 .new_with_children(
21 taffy::style::FlexboxLayout {
22 flex_direction: taffy::style::FlexDirection::Column,
23 size: taffy::geometry::Size {
24 width: taffy::style::Dimension::Points(100f32),
25 height: taffy::style::Dimension::Points(100f32),
26 ..Default::default()
27 },
28 ..Default::default()
29 },
30 &[node0, node1],
31 )
32 .unwrap();
33 taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
34 assert_eq!(taffy.layout(node).unwrap().size.width, 100f32);
35 assert_eq!(taffy.layout(node).unwrap().size.height, 100f32);
36 assert_eq!(taffy.layout(node).unwrap().location.x, 0f32);
37 assert_eq!(taffy.layout(node).unwrap().location.y, 0f32);
38 assert_eq!(taffy.layout(node0).unwrap().size.width, 100f32);
39 assert_eq!(taffy.layout(node0).unwrap().size.height, 60f32);
40 assert_eq!(taffy.layout(node0).unwrap().location.x, 0f32);
41 assert_eq!(taffy.layout(node0).unwrap().location.y, 0f32);
42 assert_eq!(taffy.layout(node1).unwrap().size.width, 100f32);
43 assert_eq!(taffy.layout(node1).unwrap().size.height, 40f32);
44 assert_eq!(taffy.layout(node1).unwrap().location.x, 0f32);
45 assert_eq!(taffy.layout(node1).unwrap().location.y, 60f32);
46}