1#[test]
2fn rounding_fractial_input_3() {
3 let mut taffy = taffy::Taffy::new();
4 let node0 = taffy
5 .new_node(
6 taffy::style::Style {
7 flex_grow: 1f32,
8 flex_basis: taffy::style::Dimension::Points(50f32),
9 size: taffy::geometry::Size { height: taffy::style::Dimension::Points(20f32), ..Default::default() },
10 ..Default::default()
11 },
12 &[],
13 )
14 .unwrap();
15 let node1 = taffy
16 .new_node(
17 taffy::style::Style {
18 flex_grow: 1f32,
19 size: taffy::geometry::Size { height: taffy::style::Dimension::Points(10f32), ..Default::default() },
20 ..Default::default()
21 },
22 &[],
23 )
24 .unwrap();
25 let node2 = taffy
26 .new_node(
27 taffy::style::Style {
28 flex_grow: 1f32,
29 size: taffy::geometry::Size { height: taffy::style::Dimension::Points(10f32), ..Default::default() },
30 ..Default::default()
31 },
32 &[],
33 )
34 .unwrap();
35 let node = taffy
36 .new_node(
37 taffy::style::Style {
38 flex_direction: taffy::style::FlexDirection::Column,
39 size: taffy::geometry::Size {
40 width: taffy::style::Dimension::Points(100f32),
41 height: taffy::style::Dimension::Points(113.4f32),
42 ..Default::default()
43 },
44 ..Default::default()
45 },
46 &[node0, node1, node2],
47 )
48 .unwrap();
49 taffy.compute_layout(node, taffy::geometry::Size::undefined()).unwrap();
50 assert_eq!(taffy.layout(node).unwrap().size.width, 100f32);
51 assert_eq!(taffy.layout(node).unwrap().size.height, 113f32);
52 assert_eq!(taffy.layout(node).unwrap().location.x, 0f32);
53 assert_eq!(taffy.layout(node).unwrap().location.y, 0f32);
54 assert_eq!(taffy.layout(node0).unwrap().size.width, 100f32);
55 assert_eq!(taffy.layout(node0).unwrap().size.height, 64f32);
56 assert_eq!(taffy.layout(node0).unwrap().location.x, 0f32);
57 assert_eq!(taffy.layout(node0).unwrap().location.y, 0f32);
58 assert_eq!(taffy.layout(node1).unwrap().size.width, 100f32);
59 assert_eq!(taffy.layout(node1).unwrap().size.height, 25f32);
60 assert_eq!(taffy.layout(node1).unwrap().location.x, 0f32);
61 assert_eq!(taffy.layout(node1).unwrap().location.y, 64f32);
62 assert_eq!(taffy.layout(node2).unwrap().size.width, 100f32);
63 assert_eq!(taffy.layout(node2).unwrap().size.height, 24f32);
64 assert_eq!(taffy.layout(node2).unwrap().location.x, 0f32);
65 assert_eq!(taffy.layout(node2).unwrap().location.y, 89f32);
66}