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