⎇ f99b57fbad456aa2756b374ff40c876e4b9574c2
tests/generated/flex/flex_basis_unconstraint_column.rs
Historia
Quién tocó qué
crudo
Use tagged pointer to represent size/length values (#769)
1#[test]
2#[allow(non_snake_case)]
3fn flex_basis_unconstraint_column__border_box() {
4 #[allow(unused_imports)]
5 use taffy::{prelude::*, Layout};
6 let mut taffy = crate::new_test_tree();
7 let node0 = taffy
8 .new_leaf(taffy::style::Style {
9 flex_basis: taffy::style::Dimension::from_length(50f32),
10 size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() },
11 ..Default::default()
12 })
13 .unwrap();
14 let node = taffy
15 .new_with_children(
16 taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, ..Default::default() },
17 &[node0],
18 )
19 .unwrap();
20 taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap();
21 println!("\nComputed tree:");
22 taffy.print_tree(node);
23 println!();
24 let layout = taffy.layout(node).unwrap();
25 let Layout { size, location, .. } = layout;
26 assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width);
27 assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height);
28 assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x);
29 assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y);
30 let layout = taffy.layout(node0).unwrap();
31 let Layout { size, location, .. } = layout;
32 assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width);
33 assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height);
34 assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x);
35 assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y);
36}
37
38#[test]
39#[allow(non_snake_case)]
40fn flex_basis_unconstraint_column__content_box() {
41 #[allow(unused_imports)]
42 use taffy::{prelude::*, Layout};
43 let mut taffy = crate::new_test_tree();
44 let node0 = taffy
45 .new_leaf(taffy::style::Style {
46 box_sizing: taffy::style::BoxSizing::ContentBox,
47 flex_basis: taffy::style::Dimension::from_length(50f32),
48 size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() },
49 ..Default::default()
50 })
51 .unwrap();
52 let node = taffy
53 .new_with_children(
54 taffy::style::Style {
55 box_sizing: taffy::style::BoxSizing::ContentBox,
56 flex_direction: taffy::style::FlexDirection::Column,
57 ..Default::default()
58 },
59 &[node0],
60 )
61 .unwrap();
62 taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap();
63 println!("\nComputed tree:");
64 taffy.print_tree(node);
65 println!();
66 let layout = taffy.layout(node).unwrap();
67 let Layout { size, location, .. } = layout;
68 assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width);
69 assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height);
70 assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x);
71 assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y);
72 let layout = taffy.layout(node0).unwrap();
73 let Layout { size, location, .. } = layout;
74 assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width);
75 assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height);
76 assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x);
77 assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y);
78}