Rename FlexboxLayout back to Style (#251)
1#[test]
2fn min_max_percent_no_width_height() {
3 let mut taffy = taffy::Taffy::new();
4 let node0 = taffy
5 .new_with_children(
6 taffy::style::Style {
7 min_size: taffy::geometry::Size {
8 width: taffy::style::Dimension::Percent(0.1f32),
9 height: taffy::style::Dimension::Percent(0.1f32),
10 ..Default::default()
11 },
12 max_size: taffy::geometry::Size {
13 width: taffy::style::Dimension::Percent(0.1f32),
14 height: taffy::style::Dimension::Percent(0.1f32),
15 ..Default::default()
16 },
17 ..Default::default()
18 },
19 &[],
20 )
21 .unwrap();
22 let node = taffy
23 .new_with_children(
24 taffy::style::Style {
25 flex_direction: taffy::style::FlexDirection::Column,
26 align_items: taffy::style::AlignItems::FlexStart,
27 size: taffy::geometry::Size {
28 width: taffy::style::Dimension::Points(100f32),
29 height: taffy::style::Dimension::Points(100f32),
30 ..Default::default()
31 },
32 ..Default::default()
33 },
34 &[node0],
35 )
36 .unwrap();
37 taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
38 assert_eq!(taffy.layout(node).unwrap().size.width, 100f32);
39 assert_eq!(taffy.layout(node).unwrap().size.height, 100f32);
40 assert_eq!(taffy.layout(node).unwrap().location.x, 0f32);
41 assert_eq!(taffy.layout(node).unwrap().location.y, 0f32);
42 assert_eq!(taffy.layout(node0).unwrap().size.width, 10f32);
43 assert_eq!(taffy.layout(node0).unwrap().size.height, 10f32);
44 assert_eq!(taffy.layout(node0).unwrap().location.x, 0f32);
45 assert_eq!(taffy.layout(node0).unwrap().location.y, 0f32);
46}