⎇ f99b57fbad456aa2756b374ff40c876e4b9574c2
tests/generated/flex/border_no_size.rs
Ñawpa willay
Pi imata llamkarqan
ch'uya
Use tagged pointer to represent size/length values (#769)
1#[test]
2#[allow(non_snake_case)]
3fn border_no_size__border_box() {
4 #[allow(unused_imports)]
5 use taffy::{prelude::*, Layout};
6 let mut taffy = crate::new_test_tree();
7 let node = taffy
8 .new_leaf(taffy::style::Style {
9 flex_direction: taffy::style::FlexDirection::Column,
10 border: taffy::geometry::Rect {
11 left: length(10f32),
12 right: length(10f32),
13 top: length(10f32),
14 bottom: length(10f32),
15 },
16 ..Default::default()
17 })
18 .unwrap();
19 taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap();
20 println!("\nComputed tree:");
21 taffy.print_tree(node);
22 println!();
23 let layout = taffy.layout(node).unwrap();
24 let Layout { size, location, .. } = layout;
25 assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width);
26 assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height);
27 assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x);
28 assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y);
29}
30
31#[test]
32#[allow(non_snake_case)]
33fn border_no_size__content_box() {
34 #[allow(unused_imports)]
35 use taffy::{prelude::*, Layout};
36 let mut taffy = crate::new_test_tree();
37 let node = taffy
38 .new_leaf(taffy::style::Style {
39 box_sizing: taffy::style::BoxSizing::ContentBox,
40 flex_direction: taffy::style::FlexDirection::Column,
41 border: taffy::geometry::Rect {
42 left: length(10f32),
43 right: length(10f32),
44 top: length(10f32),
45 bottom: length(10f32),
46 },
47 ..Default::default()
48 })
49 .unwrap();
50 taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap();
51 println!("\nComputed tree:");
52 taffy.print_tree(node);
53 println!();
54 let layout = taffy.layout(node).unwrap();
55 let Layout { size, location, .. } = layout;
56 assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width);
57 assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height);
58 assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x);
59 assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y);
60}