diff --git a/README.md b/README.md index 7411cff6d..f6c073e50 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Right now, it powers: use taffy::prelude::*; // First create an instance of Taffy -let mut taffy = Taffy::new(); +let mut taffy : Taffy<()> = Taffy::new(); // Create a tree of nodes using `taffy.new_leaf` and `taffy.new_with_children`. // These functions both return a node id which can be used to refer to that node diff --git a/RELEASES.md b/RELEASES.md index 4479cc896..c1d7cf3ba 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -4,7 +4,63 @@ ### Breaking -Many APIs have been renamed to replace `points` or `Points` with `length` or `Length`. +#### Measure function changes + +The "measure function" API for integrating Taffy with other measurement systems (such as text layout) has been changed to be more flexible, +and to interact better with borrow checking (you can now borrow external data in your measure function!). + +- There are no longer per-node measure functions. +- There is now a single "global" measure function, and a per-node "context" of a user-defined type +- The `Taffy` tree is now a generic `Taffy` where `T` is the "context" type. + +If you are not using measure functions, then the only change you will need to make is from: + +```rust +let mut tree = Taffy::new(); +``` + +to + +```rust +let mut tree : Taffy<()> = Taffy::new(); +``` + +And generally update any uses of `Taffy` in your codebase to `Taffy<()>`. + +If you are using measure functions then you will need to make some bigger (but straightforward) changes. The following Taffy 0.3 code: + +```rust +let mut tree = Taffy::new(); +let leaf = tree.new_leaf_with_measure( + Style::DEFAULT, + |known_dimensions: Size>, available_space: Size| Size { width: 100.0, height: 200.0 } +); +tree.compute_layout(leaf, Size::MAX_CONTENT); +``` + +Should become something like the following with Taffy 0.4: + +```rust +let mut tree : Taffy = Taffy::new(); +let leaf = tree.new_leaf_with_context(Style::DEFAULT, Size { width: 100.0, height: 200.0 }); +tree.compute_layout_with_measure( + leaf, + Size::MAX_CONTENT, + |known_dimensions: Size>, available_space: Size, node_id: NodeId, node_context: Option| { + node_context.unwrap_or(Size::ZERO) + } +); +``` + +Note that: + +- You can choose any type instead of `Size` in the above example. This includes your own custom type (which can be an enum or a trait object). +- If you don't need a context then you can use `()` for the context type +- As the single "global" measure function passed to `compute_layout_with_measure` only needs to exist for the duration of a single layout run, + it can (mutably) borrow data from it's environment + +#### Many APIs have been renamed to replace `points` or `Points` with `length` or `Length` + This new name better describes one-dimentional measure of space in some unspecified unit which is often unrelated to the PostScript point or the CSS `pt` unit. diff --git a/examples/basic.rs b/examples/basic.rs index 7a5a0fcc2..5d951920d 100644 --- a/examples/basic.rs +++ b/examples/basic.rs @@ -1,7 +1,7 @@ use taffy::prelude::*; fn main() -> Result<(), taffy::TaffyError> { - let mut taffy = Taffy::new(); + let mut taffy: Taffy<()> = Taffy::new(); let child = taffy.new_leaf(Style { size: Size { width: Dimension::Percent(0.5), height: Dimension::Auto }, diff --git a/examples/flexbox_gap.rs b/examples/flexbox_gap.rs index 0616527c6..59c689c0d 100644 --- a/examples/flexbox_gap.rs +++ b/examples/flexbox_gap.rs @@ -4,7 +4,7 @@ use taffy::prelude::*; // Thus the container is 80px x 20px. fn main() -> Result<(), taffy::TaffyError> { - let mut taffy = Taffy::new(); + let mut taffy: Taffy<()> = Taffy::new(); let child_style = Style { size: Size { width: length(20.0), height: length(20.0) }, ..Default::default() }; let child0 = taffy.new_leaf(child_style.clone())?; @@ -18,7 +18,7 @@ fn main() -> Result<(), taffy::TaffyError> { // Compute layout and print result taffy.compute_layout(root, Size::MAX_CONTENT)?; - taffy::util::print_tree(&taffy, root); + taffy.print_tree(root); Ok(()) } diff --git a/examples/grid_holy_grail.rs b/examples/grid_holy_grail.rs index 1c95a9238..a8e0842f9 100644 --- a/examples/grid_holy_grail.rs +++ b/examples/grid_holy_grail.rs @@ -19,7 +19,7 @@ fn default() -> T { fn main() -> Result<(), taffy::TaffyError> { use taffy::prelude::*; - let mut taffy = Taffy::new(); + let mut taffy: Taffy<()> = Taffy::new(); // Setup the grid let root_style = Style { @@ -42,7 +42,7 @@ fn main() -> Result<(), taffy::TaffyError> { // Compute layout and print result taffy.compute_layout(root, Size { width: length(800.0), height: length(600.0) })?; - taffy::util::print_tree(&taffy, root); + taffy.print_tree(root); Ok(()) } diff --git a/examples/measure.rs b/examples/measure.rs new file mode 100644 index 000000000..5df8b7222 --- /dev/null +++ b/examples/measure.rs @@ -0,0 +1,146 @@ +use taffy::prelude::*; + +const LOREM_IPSUM : &str = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."; + +struct FontMetrics { + char_width: f32, + char_height: f32, +} +enum WritingMode { + Horizontal, + Vertical, +} +struct TextContext { + text_content: String, + writing_mode: WritingMode, +} +struct ImageContext { + width: f32, + height: f32, +} +enum NodeContext { + Text(TextContext), + Image(ImageContext), +} + +fn main() -> Result<(), taffy::TaffyError> { + let mut taffy: Taffy = Taffy::new(); + + let font_metrics = FontMetrics { char_width: 10.0, char_height: 10.0 }; + + let text_node = taffy.new_leaf_with_context( + Style::default(), + NodeContext::Text(TextContext { text_content: LOREM_IPSUM.into(), writing_mode: WritingMode::Horizontal }), + )?; + + let image_node = taffy + .new_leaf_with_context(Style::default(), NodeContext::Image(ImageContext { width: 400.0, height: 300.0 }))?; + + let root = taffy.new_with_children( + Style { + display: Display::Flex, + flex_direction: FlexDirection::Column, + size: Size { width: length(200.0), height: auto() }, + ..Default::default() + }, + &[text_node, image_node], + )?; + + // Compute layout and print result + taffy.compute_layout_with_measure( + root, + Size::MAX_CONTENT, + // Note: this closure is a FnMut closure and can be used to borrow external context for the duration of layout + // For example, you may wish to borrow a global font registry and pass it into your text measuring function + |known_dimensions, available_space, _node_id, node_context| { + measure_function(known_dimensions, available_space, node_context, &font_metrics) + }, + )?; + taffy.print_tree(root); + + Ok(()) +} + +fn measure_function( + known_dimensions: taffy::geometry::Size>, + available_space: taffy::geometry::Size, + node_context: Option<&mut NodeContext>, + font_metrics: &FontMetrics, +) -> Size { + if let Size { width: Some(width), height: Some(height) } = known_dimensions { + return Size { width, height }; + } + + match node_context { + None => Size::ZERO, + Some(NodeContext::Text(text_context)) => { + text_measure_function(known_dimensions, available_space, &*text_context, font_metrics) + } + Some(NodeContext::Image(image_context)) => image_measure_function(known_dimensions, image_context), + } +} + +fn image_measure_function( + known_dimensions: taffy::geometry::Size>, + image_context: &ImageContext, +) -> taffy::geometry::Size { + match (known_dimensions.width, known_dimensions.height) { + (Some(width), Some(height)) => Size { width, height }, + (Some(width), None) => Size { width, height: (width / image_context.width) * image_context.height }, + (None, Some(height)) => Size { width: (height / image_context.height) * image_context.width, height }, + (None, None) => Size { width: image_context.width, height: image_context.height }, + } +} + +fn text_measure_function( + known_dimensions: taffy::geometry::Size>, + available_space: taffy::geometry::Size, + text_context: &TextContext, + font_metrics: &FontMetrics, +) -> taffy::geometry::Size { + use taffy::geometry::AbsoluteAxis; + use taffy::prelude::*; + + let inline_axis = match text_context.writing_mode { + WritingMode::Horizontal => AbsoluteAxis::Horizontal, + WritingMode::Vertical => AbsoluteAxis::Vertical, + }; + let block_axis = inline_axis.other_axis(); + let words: Vec<&str> = text_context.text_content.split_whitespace().collect(); + + if words.is_empty() { + return Size::ZERO; + } + + let min_line_length: usize = words.iter().map(|line| line.len()).max().unwrap_or(0); + let max_line_length: usize = words.iter().map(|line| line.len()).sum(); + let inline_size = + known_dimensions.get_abs(inline_axis).unwrap_or_else(|| match available_space.get_abs(inline_axis) { + AvailableSpace::MinContent => min_line_length as f32 * font_metrics.char_width, + AvailableSpace::MaxContent => max_line_length as f32 * font_metrics.char_width, + AvailableSpace::Definite(inline_size) => inline_size + .min(max_line_length as f32 * font_metrics.char_width) + .max(min_line_length as f32 * font_metrics.char_width), + }); + let block_size = known_dimensions.get_abs(block_axis).unwrap_or_else(|| { + let inline_line_length = (inline_size / font_metrics.char_width).floor() as usize; + let mut line_count = 1; + let mut current_line_length = 0; + for word in &words { + if current_line_length + word.len() > inline_line_length { + if current_line_length > 0 { + line_count += 1 + }; + current_line_length = word.len(); + } else { + current_line_length += word.len(); + }; + } + (line_count as f32) * font_metrics.char_height + }); + + match text_context.writing_mode { + WritingMode::Horizontal => Size { width: inline_size, height: block_size }, + WritingMode::Vertical => Size { width: block_size, height: inline_size }, + } +} diff --git a/examples/nested.rs b/examples/nested.rs index 1e0d6bbde..17ce6a356 100644 --- a/examples/nested.rs +++ b/examples/nested.rs @@ -1,7 +1,7 @@ use taffy::prelude::*; fn main() -> Result<(), taffy::TaffyError> { - let mut taffy = Taffy::new(); + let mut taffy: Taffy<()> = Taffy::new(); // left let child_t1 = taffy.new_leaf(Style { diff --git a/scripts/gentest/src/main.rs b/scripts/gentest/src/main.rs index da57c339d..4163ccc38 100644 --- a/scripts/gentest/src/main.rs +++ b/scripts/gentest/src/main.rs @@ -215,14 +215,14 @@ fn generate_test(name: impl AsRef, description: &Value) -> TokenStream { #[test] fn #name() { #[allow(unused_imports)] - use taffy::{tree::Layout, prelude::*}; - let mut taffy = taffy::Taffy::new(); + use taffy::{tree::Layout, prelude::*, Taffy}; + let mut taffy : Taffy = Taffy::new(); #set_rounding_mode #node_description - taffy.compute_layout(node, #available_space).unwrap(); + taffy.compute_layout_with_measure(node, #available_space, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); #assertions @@ -556,8 +556,7 @@ fn generate_node(ident: &str, node: &Value) -> TokenStream { let text_content = get_string_value("text_content", node); let writing_mode = get_string_value("writingMode", style); let raw_aspect_ratio = get_number_value("aspect_ratio", style); - let measure_func: Option<_> = - text_content.map(|text| generate_measure_function(text, writing_mode, raw_aspect_ratio)); + let node_context: Option<_> = text_content.map(|text| generate_node_context(text, writing_mode, raw_aspect_ratio)); edges_quoted!(style, margin, generate_length_percentage_auto, quote!(zero())); edges_quoted!(style, padding, generate_length_percentage, quote!(zero())); @@ -629,8 +628,8 @@ fn generate_node(ident: &str, node: &Value) -> TokenStream { #children_body let #ident = taffy.new_with_children(#style,#children).unwrap(); ) - } else if measure_func.is_some() { - quote!(let #ident = taffy.new_leaf_with_measure(#style,#measure_func,).unwrap();) + } else if node_context.is_some() { + quote!(let #ident = taffy.new_leaf_with_context(#style,#node_context,).unwrap();) } else { quote!(let #ident = taffy.new_leaf(#style).unwrap();) } @@ -867,7 +866,7 @@ fn generate_scalar_definition(track_definition: &serde_json::Map) } } -fn generate_measure_function(text_content: &str, writing_mode: Option<&str>, aspect_ratio: Option) -> TokenStream { +fn generate_node_context(text_content: &str, writing_mode: Option<&str>, aspect_ratio: Option) -> TokenStream { let writing_mode_token = match writing_mode { Some("vertical-rl" | "vertical-lr") => quote!(crate::WritingMode::Vertical), _ => quote!(crate::WritingMode::Horizontal), @@ -879,9 +878,10 @@ fn generate_measure_function(text_content: &str, writing_mode: Option<&str>, asp }; quote!( - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT : &str = #text_content; - crate::measure_standard_text(known_dimensions, available_space, TEXT, #writing_mode_token, #aspect_ratio_token) - }) + crate::TextMeasure { + text_content: #text_content, + writing_mode: #writing_mode_token, + _aspect_ratio: #aspect_ratio_token, + } ) } diff --git a/src/compute/flexbox.rs b/src/compute/flexbox.rs index 689b82717..afb503c86 100644 --- a/src/compute/flexbox.rs +++ b/src/compute/flexbox.rs @@ -2132,7 +2132,7 @@ mod tests { // Make sure we get correct constants #[test] fn correct_constants() { - let mut tree = Taffy::with_capacity(16); + let mut tree: Taffy<()> = Taffy::with_capacity(16); let style = Style::default(); let node_id = tree.new_leaf(style.clone()).unwrap(); diff --git a/src/compute/leaf.rs b/src/compute/leaf.rs index 040e02ca1..dfc37b1e5 100644 --- a/src/compute/leaf.rs +++ b/src/compute/leaf.rs @@ -1,8 +1,9 @@ //! Computes size using styles and measure functions -use crate::geometry::{Line, Point, Size}; +use crate::geometry::{Point, Size}; use crate::style::{AvailableSpace, Display, Overflow, Position, Style}; -use crate::tree::{CollapsibleMarginSet, Measurable}; +use crate::tree::CollapsibleMarginSet; +use crate::tree::NodeId; use crate::tree::{SizeBaselinesAndMargins, SizingMode}; use crate::util::sys::f32_max; use crate::util::MaybeMath; @@ -12,40 +13,56 @@ use crate::util::{MaybeResolve, ResolveOrZero}; use crate::util::debug::NODE_LOGGER; /// Perform full layout on a leaf node -pub(crate) fn perform_layout( +#[allow(clippy::too_many_arguments)] +pub(crate) fn perform_layout( style: &Style, - measurable: Option<&impl Measurable>, known_dimensions: Size>, parent_size: Size>, available_space: Size, sizing_mode: SizingMode, - _vertical_margins_are_collapsible: Line, -) -> SizeBaselinesAndMargins { - compute(style, measurable, known_dimensions, parent_size, available_space, sizing_mode) + measure_function: MeasureFunction, + node_id: NodeId, + context: Option<&mut NodeContext>, +) -> SizeBaselinesAndMargins +where + MeasureFunction: FnMut(Size>, Size, NodeId, Option<&mut NodeContext>) -> Size, +{ + compute(style, known_dimensions, parent_size, available_space, sizing_mode, measure_function, node_id, context) } /// Measure a leaf node's size -pub(crate) fn measure_size( +#[allow(clippy::too_many_arguments)] +pub(crate) fn measure_size( style: &Style, - measurable: Option<&impl Measurable>, known_dimensions: Size>, parent_size: Size>, available_space: Size, sizing_mode: SizingMode, - _vertical_margins_are_collapsible: Line, -) -> Size { - compute(style, measurable, known_dimensions, parent_size, available_space, sizing_mode).size + measure_function: MeasureFunction, + node_id: NodeId, + context: Option<&mut NodeContext>, +) -> Size +where + MeasureFunction: FnMut(Size>, Size, NodeId, Option<&mut NodeContext>) -> Size, +{ + compute(style, known_dimensions, parent_size, available_space, sizing_mode, measure_function, node_id, context).size } /// Compute the size of a leaf node (node with no children) -pub fn compute( +#[allow(clippy::too_many_arguments)] +pub fn compute( style: &Style, - measurable: Option<&impl Measurable>, known_dimensions: Size>, parent_size: Size>, available_space: Size, sizing_mode: SizingMode, -) -> SizeBaselinesAndMargins { + mut measure_function: MeasureFunction, + node_id: NodeId, + context: Option<&mut NodeContext>, +) -> SizeBaselinesAndMargins +where + MeasureFunction: FnMut(Size>, Size, NodeId, Option<&mut NodeContext>) -> Size, +{ // Resolve node's preferred/min/max sizes (width/heights) against the available space (percentages resolve to pixel values) // For ContentSize mode, we pretend that the node has no size styles as these should be ignored. let (node_size, node_min_size, node_max_size, aspect_ratio) = match sizing_mode { @@ -120,11 +137,11 @@ pub fn compute( bottom_margin: CollapsibleMarginSet::ZERO, margins_can_collapse_through: !has_styles_preventing_being_collapsed_through && size.height == 0.0 - && measurable.is_none(), + && context.is_none(), }; }; - if let Some(measurable) = measurable { + if let Some(context) = context { // Compute available space let available_space = Size { width: available_space @@ -146,7 +163,7 @@ pub fn compute( }; // Measure node - let measured_size = measurable.measure(known_dimensions, available_space); + let measured_size = measure_function(known_dimensions, available_space, node_id, Some(context)); let clamped_size = node_size.unwrap_or(measured_size + content_box_inset.sum_axes()).maybe_clamp(node_min_size, node_max_size); let size = Size { diff --git a/src/compute/mod.rs b/src/compute/mod.rs index 5113839e8..48946310f 100644 --- a/src/compute/mod.rs +++ b/src/compute/mod.rs @@ -110,11 +110,12 @@ mod tests { use super::perform_hidden_layout; use crate::geometry::{Point, Size}; use crate::style::{Display, Style}; + use crate::tree::TaffyView; use crate::Taffy; #[test] fn hidden_layout_should_hide_recursively() { - let mut taffy = Taffy::new(); + let mut taffy: Taffy<()> = Taffy::new(); let style: Style = Style { display: Display::Flex, size: Size::from_lengths(50.0, 50.0), ..Default::default() }; @@ -132,7 +133,10 @@ mod tests { ) .unwrap(); - perform_hidden_layout(&mut taffy, root.into()); + perform_hidden_layout( + &mut TaffyView { taffy: &mut taffy, measure_function: |_, _, _, _| Size::ZERO }, + root.into(), + ); // Whatever size and display-mode the nodes had previously, // all layouts should resolve to ZERO due to the root's DISPLAY::NONE diff --git a/src/compute/taffy_tree.rs b/src/compute/taffy_tree.rs index 3d2efae5e..d5cce7843 100644 --- a/src/compute/taffy_tree.rs +++ b/src/compute/taffy_tree.rs @@ -3,7 +3,9 @@ use crate::compute::{leaf, LayoutAlgorithm}; use crate::geometry::{Line, Point, Size}; use crate::style::{AvailableSpace, Display}; -use crate::tree::{Layout, LayoutTree, NodeId, RunMode, SizeBaselinesAndMargins, SizingMode, Taffy, TaffyError}; +use crate::tree::{ + Layout, LayoutTree, NodeId, RunMode, SizeBaselinesAndMargins, SizingMode, Taffy, TaffyError, TaffyView, +}; use crate::util::sys::round; #[cfg(feature = "block_layout")] @@ -34,16 +36,17 @@ fn debug_log_node( } /// Updates the stored layout of the provided `node` and its children -pub(crate) fn compute_layout( - taffy: &mut Taffy, +pub(crate) fn compute_layout( + taffy_view: &mut TaffyView, root: NodeId, available_space: Size, -) -> Result<(), TaffyError> { - taffy.is_layouting = true; - +) -> Result<(), TaffyError> +where + MeasureFunction: FnMut(Size>, Size, NodeId, Option<&mut NodeContext>) -> Size, +{ // Recursively compute node layout let size_and_baselines = perform_node_layout( - taffy, + taffy_view, root, Size::NONE, available_space.into_options(), @@ -53,30 +56,31 @@ pub(crate) fn compute_layout( ); let layout = Layout { order: 0, size: size_and_baselines.size, location: Point::ZERO }; - *taffy.layout_mut(root) = layout; + *taffy_view.layout_mut(root) = layout; // If rounding is enabled, recursively round the layout's of this node and all children - if taffy.config.use_rounding { - round_layout(taffy, root, 0.0, 0.0); + if taffy_view.taffy.config.use_rounding { + round_layout(taffy_view.taffy, root, 0.0, 0.0); } - taffy.is_layouting = false; - Ok(()) } /// Perform full layout on a node. Chooses which algorithm to use based on the `display` property. -pub(crate) fn perform_node_layout( - tree: &mut Taffy, +pub(crate) fn perform_node_layout( + taffy_view: &mut TaffyView, node: NodeId, known_dimensions: Size>, parent_size: Size>, available_space: Size, sizing_mode: SizingMode, vertical_margins_are_collapsible: Line, -) -> SizeBaselinesAndMargins { +) -> SizeBaselinesAndMargins +where + MeasureFunction: FnMut(Size>, Size, NodeId, Option<&mut NodeContext>) -> Size, +{ compute_node_layout( - tree, + taffy_view, node, known_dimensions, parent_size, @@ -88,17 +92,20 @@ pub(crate) fn perform_node_layout( } /// Measure a node's size. Chooses which algorithm to use based on the `display` property. -pub(crate) fn measure_node_size( - tree: &mut Taffy, +pub(crate) fn measure_node_size( + taffy_view: &mut TaffyView, node: NodeId, known_dimensions: Size>, parent_size: Size>, available_space: Size, sizing_mode: SizingMode, vertical_margins_are_collapsible: Line, -) -> Size { +) -> Size +where + MeasureFunction: FnMut(Size>, Size, NodeId, Option<&mut NodeContext>) -> Size, +{ compute_node_layout( - tree, + taffy_view, node, known_dimensions, parent_size, @@ -112,8 +119,8 @@ pub(crate) fn measure_node_size( /// Updates the stored layout of the provided `node` and its children #[allow(clippy::too_many_arguments)] -fn compute_node_layout( - tree: &mut Taffy, +fn compute_node_layout( + taffy_view: &mut TaffyView, node: NodeId, known_dimensions: Size>, parent_size: Size>, @@ -121,19 +128,22 @@ fn compute_node_layout( run_mode: RunMode, sizing_mode: SizingMode, vertical_margins_are_collapsible: Line, -) -> SizeBaselinesAndMargins { +) -> SizeBaselinesAndMargins +where + MeasureFunction: FnMut(Size>, Size, NodeId, Option<&mut NodeContext>) -> Size, +{ #[cfg(any(feature = "debug", feature = "profile"))] NODE_LOGGER.push_node(node); #[cfg(feature = "debug")] println!(); let node_key = node.into(); - let has_children = !tree.children[node_key].is_empty(); + let has_children = !taffy_view.taffy.children[node_key].is_empty(); // First we check if we have a cached result for the given input let cache_run_mode = if !has_children { RunMode::PerformLayout } else { run_mode }; if let Some(cached_size_and_baselines) = - tree.nodes[node_key].cache.get(known_dimensions, available_space, cache_run_mode) + taffy_view.taffy.nodes[node_key].cache.get(known_dimensions, available_space, cache_run_mode) { #[cfg(feature = "debug")] NODE_LOGGER.labelled_debug_log("CACHE", cached_size_and_baselines.size); @@ -186,15 +196,15 @@ fn compute_node_layout( } } - let display_mode = tree.nodes[node_key].style.display; + let display_mode = taffy_view.taffy.nodes[node_key].style.display; let computed_size_and_baselines = match (display_mode, has_children) { (Display::None, _) => { - perform_taffy_tree_hidden_layout(tree, node); + perform_taffy_tree_hidden_layout(taffy_view.taffy, node); SizeBaselinesAndMargins::HIDDEN } #[cfg(feature = "block_layout")] (Display::Block, true) => perform_computations::( - tree, + taffy_view, node, known_dimensions, parent_size, @@ -205,7 +215,7 @@ fn compute_node_layout( ), #[cfg(feature = "flexbox")] (Display::Flex, true) => perform_computations::( - tree, + taffy_view, node, known_dimensions, parent_size, @@ -216,7 +226,7 @@ fn compute_node_layout( ), #[cfg(feature = "grid")] (Display::Grid, true) => perform_computations::( - tree, + taffy_view, node, known_dimensions, parent_size, @@ -227,29 +237,40 @@ fn compute_node_layout( ), (_, false) => match run_mode { RunMode::PerformLayout => leaf::perform_layout( - &tree.nodes[node_key].style, - tree.nodes[node_key].needs_measure.then(|| &tree.measure_funcs[node_key]), + &taffy_view.taffy.nodes[node_key].style, known_dimensions, parent_size, available_space, sizing_mode, - vertical_margins_are_collapsible, + &mut taffy_view.measure_function, + node, + taffy_view.taffy.nodes[node_key] + .needs_measure + .then(|| &mut taffy_view.taffy.node_context_data[node_key]), ), RunMode::ComputeSize => leaf::measure_size( - &tree.nodes[node_key].style, - tree.nodes[node_key].needs_measure.then(|| &tree.measure_funcs[node_key]), + &taffy_view.taffy.nodes[node_key].style, known_dimensions, parent_size, available_space, sizing_mode, - vertical_margins_are_collapsible, + &mut taffy_view.measure_function, + node, + taffy_view.taffy.nodes[node_key] + .needs_measure + .then(|| &mut taffy_view.taffy.node_context_data[node_key]), ) .into(), }, }; // Cache result - tree.nodes[node_key].cache.store(known_dimensions, available_space, cache_run_mode, computed_size_and_baselines); + taffy_view.taffy.nodes[node_key].cache.store( + known_dimensions, + available_space, + cache_run_mode, + computed_size_and_baselines, + ); #[cfg(feature = "debug")] NODE_LOGGER.labelled_debug_log("RESULT", computed_size_and_baselines.size); @@ -261,19 +282,21 @@ fn compute_node_layout( /// Creates a layout for this node and its children, recursively. /// Each hidden node has zero size and is placed at the origin -fn perform_taffy_tree_hidden_layout(tree: &mut Taffy, node: NodeId) { +fn perform_taffy_tree_hidden_layout(tree: &mut Taffy, node: NodeId) { /// Recursive function to apply hidden layout to all descendents - fn perform_hidden_layout_inner(tree: &mut Taffy, node: NodeId, order: u32) { + fn perform_hidden_layout_inner(tree: &mut Taffy, node: NodeId, order: u32) { let node_key = node.into(); - *tree.layout_mut(node) = Layout::with_order(order); + tree.nodes[node_key].unrounded_layout = Layout::with_order(order); + tree.nodes[node_key].final_layout = Layout::with_order(order); tree.nodes[node_key].cache.clear(); for order in 0..tree.children[node_key].len() { - perform_hidden_layout_inner(tree, tree.child(node, order), order as _); + perform_hidden_layout_inner(tree, tree.children[node_key][order], order as _); } } + let node_key = node.into(); for order in 0..tree.children[node.into()].len() { - perform_hidden_layout_inner(tree, tree.child(node, order), order as _); + perform_hidden_layout_inner(tree, tree.children[node_key][order], order as _); } } @@ -288,7 +311,7 @@ fn perform_taffy_tree_hidden_layout(tree: &mut Taffy, node: NodeId) { /// /// In order to prevent innacuracies caused by rounding already-rounded values, we read from `unrounded_layout` /// and write to `final_layout`. -fn round_layout(tree: &mut Taffy, node_id: NodeId, cumulative_x: f32, cumulative_y: f32) { +fn round_layout(tree: &mut Taffy, node_id: NodeId, cumulative_x: f32, cumulative_y: f32) { let node = &mut tree.nodes[node_id.into()]; let unrounded_layout = node.unrounded_layout; let layout = &mut node.final_layout; @@ -303,7 +326,7 @@ fn round_layout(tree: &mut Taffy, node_id: NodeId, cumulative_x: f32, cumulative let child_count = tree.child_count(node_id).unwrap(); for index in 0..child_count { - let child = tree.child(node_id, index); + let child = tree.children[node_id.into()][index]; round_layout(tree, child, cumulative_x, cumulative_y); } } diff --git a/src/lib.rs b/src/lib.rs index b90036474..a531bf8aa 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,9 +1,9 @@ #![doc = include_str!("../README.md")] #![cfg_attr(not(feature = "std"), no_std)] #![deny(unsafe_code)] +#![forbid(unsafe_code)] #![warn(missing_docs)] #![warn(clippy::missing_docs_in_private_items)] -#![forbid(unsafe_code)] // We always need std for the tests // See diff --git a/src/tree/measure_func.rs b/src/tree/measure_func.rs deleted file mode 100644 index 0b2d9ae82..000000000 --- a/src/tree/measure_func.rs +++ /dev/null @@ -1,47 +0,0 @@ -//! Measure function type and trait definitions - -use crate::geometry::Size; -use crate::style::AvailableSpace; -#[cfg(any(feature = "std", feature = "alloc"))] -use crate::util::sys::Box; - -/// A function type that can be used in a [`MeasureFunc`] -/// -/// This trait is automatically implemented for all types (including closures) that define a function with the appropriate type signature. -pub trait Measurable: Send + Sync { - /// Measure node - fn measure(&self, known_dimensions: Size>, available_space: Size) -> Size; -} - -/// A function that can be used to compute the intrinsic size of a node -pub enum MeasureFunc { - /// Stores an unboxed function - Raw(fn(Size>, Size) -> Size), - - /// Stores a boxed function - #[cfg(any(feature = "std", feature = "alloc"))] - Boxed(Box), -} - -impl Measurable for MeasureFunc { - /// Call the measure function to measure to the node - #[inline(always)] - fn measure(&self, known_dimensions: Size>, available_space: Size) -> Size { - match self { - Self::Raw(measure) => measure(known_dimensions, available_space), - #[cfg(any(feature = "std", feature = "alloc"))] - Self::Boxed(measurable) => measurable.measure(known_dimensions, available_space), - } - } -} - -#[cfg(test)] -mod test { - use super::MeasureFunc; - - #[test] - fn measure_func_is_send_and_sync() { - fn is_send_and_sync() {} - is_send_and_sync::(); - } -} diff --git a/src/tree/mod.rs b/src/tree/mod.rs index 296e33182..655911c7a 100644 --- a/src/tree/mod.rs +++ b/src/tree/mod.rs @@ -6,8 +6,6 @@ use crate::style::{AvailableSpace, Style}; // Submodules mod cache; pub use cache::{Cache, CacheEntry}; -mod measure_func; -pub use measure_func::{Measurable, MeasureFunc}; mod node; #[cfg(feature = "taffy_tree")] use node::NodeData; @@ -15,7 +13,7 @@ pub use node::NodeId; #[cfg(feature = "taffy_tree")] mod taffy_tree; #[cfg(feature = "taffy_tree")] -pub use taffy_tree::{Taffy, TaffyChildIter, TaffyError, TaffyResult}; +pub use taffy_tree::{Taffy, TaffyChildIter, TaffyError, TaffyResult, TaffyView}; mod layout; pub use layout::{CollapsibleMarginSet, Layout, RunMode, SizeBaselinesAndMargins, SizingMode}; diff --git a/src/tree/taffy_tree/mod.rs b/src/tree/taffy_tree/mod.rs index 64f7fce4e..3aae953b9 100644 --- a/src/tree/taffy_tree/mod.rs +++ b/src/tree/taffy_tree/mod.rs @@ -4,4 +4,4 @@ mod error; mod tree; pub use error::{TaffyError, TaffyResult}; -pub use tree::{Taffy, TaffyChildIter}; +pub use tree::{Taffy, TaffyChildIter, TaffyView}; diff --git a/src/tree/taffy_tree/tree.rs b/src/tree/taffy_tree/tree.rs index 5fb00079a..effd39000 100644 --- a/src/tree/taffy_tree/tree.rs +++ b/src/tree/taffy_tree/tree.rs @@ -7,7 +7,7 @@ use crate::compute::taffy_tree::{compute_layout, measure_node_size, perform_node use crate::geometry::{Line, Size}; use crate::prelude::LayoutTree; use crate::style::{AvailableSpace, Style}; -use crate::tree::{Layout, MeasureFunc, NodeData, NodeId, SizeBaselinesAndMargins, SizingMode}; +use crate::tree::{Layout, NodeData, NodeId, SizeBaselinesAndMargins, SizingMode}; use crate::util::sys::{new_vec_with_capacity, ChildrenVec, Vec}; use super::{TaffyError, TaffyResult}; @@ -25,12 +25,12 @@ impl Default for TaffyConfig { } /// A tree of UI nodes suitable for UI layout -pub struct Taffy { +pub struct Taffy { /// The [`NodeData`] for each node stored in this tree pub(crate) nodes: SlotMap, /// Functions/closures that compute the intrinsic size of leaf nodes - pub(crate) measure_funcs: SparseSecondaryMap, + pub(crate) node_context_data: SparseSecondaryMap, /// The children of each node /// @@ -44,15 +44,10 @@ pub struct Taffy { /// Layout mode configuration pub(crate) config: TaffyConfig, - - /// Hack to allow the `LayoutTree::layout_mut` function to expose the `NodeData.unrounded_layout` of a node to - /// the layout algorithms during layout, while exposing the `NodeData.final_layout` when called by external users. - /// This allows us to fix without breaking backwards compatibility - pub(crate) is_layouting: bool, } impl Default for Taffy { - fn default() -> Self { + fn default() -> Taffy<()> { Taffy::new() } } @@ -67,45 +62,61 @@ impl<'a> Iterator for TaffyChildIter<'a> { } } -impl LayoutTree for Taffy { - type ChildIter<'a> = TaffyChildIter<'a>; +/// View over the Taffy tree that holds the tree itself along with a reference to the context +/// and implements LayoutTree. This allows the context to be stored outside of the Taffy struct +/// which makes the lifetimes of the context much more flexible. +pub struct TaffyView<'t, NodeContext, MeasureFunction> +where + MeasureFunction: FnMut(Size>, Size, NodeId, Option<&mut NodeContext>) -> Size, +{ + /// A reference to the Taffy tree + pub(crate) taffy: &'t mut Taffy, + /// The context provided for passing to measure functions if layout is run over this struct + pub(crate) measure_function: MeasureFunction, +} + +impl<'t, NodeContext, MeasureFunction> LayoutTree for TaffyView<'t, NodeContext, MeasureFunction> +where + MeasureFunction: FnMut(Size>, Size, NodeId, Option<&mut NodeContext>) -> Size, +{ + type ChildIter<'a> = TaffyChildIter<'a> where Self: 'a; #[inline(always)] fn children(&self, node: NodeId) -> Self::ChildIter<'_> { - TaffyChildIter(self.children[node.into()].iter()) + TaffyChildIter(self.taffy.children[node.into()].iter()) } #[inline(always)] fn child_count(&self, node: NodeId) -> usize { - self.children[node.into()].len() + self.taffy.children[node.into()].len() } #[inline(always)] fn style(&self, node: NodeId) -> &Style { - &self.nodes[node.into()].style + &self.taffy.nodes[node.into()].style } #[inline(always)] fn layout(&self, node: NodeId) -> &Layout { - if self.is_layouting && self.config.use_rounding { - &self.nodes[node.into()].unrounded_layout + if self.taffy.config.use_rounding { + &self.taffy.nodes[node.into()].unrounded_layout } else { - &self.nodes[node.into()].final_layout + &self.taffy.nodes[node.into()].final_layout } } #[inline(always)] fn layout_mut(&mut self, node: NodeId) -> &mut Layout { - if self.is_layouting && self.config.use_rounding { - &mut self.nodes[node.into()].unrounded_layout + if self.taffy.config.use_rounding { + &mut self.taffy.nodes[node.into()].unrounded_layout } else { - &mut self.nodes[node.into()].final_layout + &mut self.taffy.nodes[node.into()].final_layout } } #[inline(always)] fn child(&self, node: NodeId, id: usize) -> NodeId { - self.children[node.into()][id] + self.taffy.children[node.into()][id] } #[inline(always)] @@ -152,7 +163,7 @@ impl LayoutTree for Taffy { } #[allow(clippy::iter_cloned_collect)] // due to no-std support, we need to use `iter_cloned` instead of `collect` -impl Taffy { +impl Taffy { /// Creates a new [`Taffy`] /// /// The default capacity of a [`Taffy`] is 16 nodes. @@ -164,15 +175,14 @@ impl Taffy { /// Creates a new [`Taffy`] that can store `capacity` nodes before reallocation #[must_use] pub fn with_capacity(capacity: usize) -> Self { - Self { + Taffy { // TODO: make this method const upstream, // so constructors here can be const nodes: SlotMap::with_capacity(capacity), children: SlotMap::with_capacity(capacity), parents: SlotMap::with_capacity(capacity), - measure_funcs: SparseSecondaryMap::with_capacity(capacity), + node_context_data: SparseSecondaryMap::with_capacity(capacity), config: TaffyConfig::default(), - is_layouting: false, } } @@ -195,15 +205,15 @@ impl Taffy { Ok(id.into()) } - /// Creates and adds a new unattached leaf node to the tree, and returns the node of the new node + /// Creates and adds a new unattached leaf node to the tree, and returns the [`NodeId`] of the new node /// - /// Creates and adds a new leaf node with a supplied [`MeasureFunc`] - pub fn new_leaf_with_measure(&mut self, layout: Style, measure: MeasureFunc) -> TaffyResult { + /// Creates and adds a new leaf node with a supplied context + pub fn new_leaf_with_context(&mut self, layout: Style, context: NodeContext) -> TaffyResult { let mut data = NodeData::new(layout); data.needs_measure = true; let id = self.nodes.insert(data); - self.measure_funcs.insert(id, measure); + self.node_context_data.insert(id, context); let _ = self.children.insert(new_vec_with_capacity(0)); let _ = self.parents.insert(None); @@ -257,15 +267,15 @@ impl Taffy { Ok(node) } - /// Sets the [`MeasureFunc`] of the associated node - pub fn set_measure(&mut self, node: NodeId, measure: Option) -> TaffyResult<()> { + /// Sets the context data associated with the node + pub fn set_node_context(&mut self, node: NodeId, measure: Option) -> TaffyResult<()> { let key = node.into(); if let Some(measure) = measure { self.nodes[key].needs_measure = true; - self.measure_funcs.insert(key, measure); + self.node_context_data.insert(key, measure); } else { self.nodes[key].needs_measure = false; - self.measure_funcs.remove(key); + self.node_context_data.remove(key); } self.mark_dirty(node)?; @@ -273,6 +283,11 @@ impl Taffy { Ok(()) } + /// Get's a mutable reference to the the context data associated with the node + pub fn get_node_context_mut(&mut self, node: NodeId) -> Option<&mut NodeContext> { + self.node_context_data.get_mut(node.into()) + } + /// Adds a `child` node under the supplied `parent` pub fn add_child(&mut self, parent: NodeId, child: NodeId) -> TaffyResult<()> { let parent_key = parent.into(); @@ -442,8 +457,29 @@ impl Taffy { } /// Updates the stored layout of the provided `node` and its children - pub fn compute_layout(&mut self, node: NodeId, available_space: Size) -> TaffyResult<()> { - compute_layout(self, node, available_space) + pub fn compute_layout_with_measure( + &mut self, + node: NodeId, + available_space: Size, + measure_function: MeasureFunction, + ) -> Result<(), TaffyError> + where + MeasureFunction: FnMut(Size>, Size, NodeId, Option<&mut NodeContext>) -> Size, + { + let mut taffy_view = TaffyView { taffy: self, measure_function }; + compute_layout(&mut taffy_view, node, available_space) + } + + /// Updates the stored layout of the provided `node` and its children + pub fn compute_layout(&mut self, node: NodeId, available_space: Size) -> Result<(), TaffyError> { + self.compute_layout_with_measure(node, available_space, |_, _, _, _| Size::ZERO) + } + + /// Prints a debug representation of the tree's layout + #[cfg(feature = "std")] + pub fn print_tree(&mut self, root: NodeId) { + let taffy_view = TaffyView { taffy: self, measure_function: |_, _, _, _| Size::ZERO }; + crate::util::print_tree(&taffy_view, root) } } @@ -456,10 +492,19 @@ mod tests { use crate::style_helpers::*; use crate::util::sys; + fn size_measure_function( + known_dimensions: Size>, + _available_space: Size, + _node_id: NodeId, + node_context: Option<&mut Size>, + ) -> Size { + known_dimensions.unwrap_or(node_context.cloned().unwrap_or(Size::ZERO)) + } + #[test] fn new_should_allocate_default_capacity() { const DEFAULT_CAPACITY: usize = 16; // This is the capacity defined in the `impl Default` - let taffy = Taffy::new(); + let taffy: Taffy<()> = Taffy::new(); assert!(taffy.children.capacity() >= DEFAULT_CAPACITY); assert!(taffy.parents.capacity() >= DEFAULT_CAPACITY); @@ -469,7 +514,7 @@ mod tests { #[test] fn test_with_capacity() { const CAPACITY: usize = 8; - let taffy = Taffy::with_capacity(CAPACITY); + let taffy: Taffy<()> = Taffy::with_capacity(CAPACITY); assert!(taffy.children.capacity() >= CAPACITY); assert!(taffy.parents.capacity() >= CAPACITY); @@ -478,7 +523,7 @@ mod tests { #[test] fn test_new_leaf() { - let mut taffy = Taffy::new(); + let mut taffy: Taffy<()> = Taffy::new(); let res = taffy.new_leaf(Style::default()); assert!(res.is_ok()); @@ -489,10 +534,10 @@ mod tests { } #[test] - fn new_leaf_with_measure() { - let mut taffy = Taffy::new(); + fn new_leaf_with_context() { + let mut taffy: Taffy> = Taffy::new(); - let res = taffy.new_leaf_with_measure(Style::default(), MeasureFunc::Raw(|_, _| Size::ZERO)); + let res = taffy.new_leaf_with_context(Style::default(), Size::ZERO); assert!(res.is_ok()); let node = res.unwrap(); @@ -503,7 +548,7 @@ mod tests { /// Test that new_with_children works as expected #[test] fn test_new_with_children() { - let mut taffy = Taffy::new(); + let mut taffy: Taffy<()> = Taffy::new(); let child0 = taffy.new_leaf(Style::default()).unwrap(); let child1 = taffy.new_leaf(Style::default()).unwrap(); let node = taffy.new_with_children(Style::default(), &[child0, child1]).unwrap(); @@ -516,7 +561,7 @@ mod tests { #[test] fn remove_node_should_remove() { - let mut taffy = Taffy::new(); + let mut taffy: Taffy<()> = Taffy::new(); let node = taffy.new_leaf(Style::default()).unwrap(); @@ -525,7 +570,7 @@ mod tests { #[test] fn remove_node_should_detach_herarchy() { - let mut taffy = Taffy::new(); + let mut taffy: Taffy<()> = Taffy::new(); // Build a linear tree layout: <0> <- <1> <- <2> let node2 = taffy.new_leaf(Style::default()).unwrap(); @@ -546,7 +591,7 @@ mod tests { #[test] fn remove_last_node() { - let mut taffy = Taffy::new(); + let mut taffy: Taffy<()> = Taffy::new(); let parent = taffy.new_leaf(Style::default()).unwrap(); let child = taffy.new_leaf(Style::default()).unwrap(); @@ -558,34 +603,32 @@ mod tests { #[test] fn set_measure() { - let mut taffy = Taffy::new(); - let node = taffy - .new_leaf_with_measure(Style::default(), MeasureFunc::Raw(|_, _| Size { width: 200.0, height: 200.0 })) - .unwrap(); - taffy.compute_layout(node, Size::MAX_CONTENT).unwrap(); + let mut taffy: Taffy> = Taffy::new(); + let node = taffy.new_leaf_with_context(Style::default(), Size { width: 200.0, height: 200.0 }).unwrap(); + taffy.compute_layout_with_measure(node, Size::MAX_CONTENT, size_measure_function).unwrap(); assert_eq!(taffy.layout(node).unwrap().size.width, 200.0); - taffy.set_measure(node, Some(MeasureFunc::Raw(|_, _| Size { width: 100.0, height: 100.0 }))).unwrap(); - taffy.compute_layout(node, Size::MAX_CONTENT).unwrap(); + taffy.set_node_context(node, Some(Size { width: 100.0, height: 100.0 })).unwrap(); + taffy.compute_layout_with_measure(node, Size::MAX_CONTENT, size_measure_function).unwrap(); assert_eq!(taffy.layout(node).unwrap().size.width, 100.0); } #[test] fn set_measure_of_previously_unmeasured_node() { - let mut taffy = Taffy::new(); + let mut taffy: Taffy> = Taffy::new(); let node = taffy.new_leaf(Style::default()).unwrap(); - taffy.compute_layout(node, Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, Size::MAX_CONTENT, size_measure_function).unwrap(); assert_eq!(taffy.layout(node).unwrap().size.width, 0.0); - taffy.set_measure(node, Some(MeasureFunc::Raw(|_, _| Size { width: 100.0, height: 100.0 }))).unwrap(); - taffy.compute_layout(node, Size::MAX_CONTENT).unwrap(); + taffy.set_node_context(node, Some(Size { width: 100.0, height: 100.0 })).unwrap(); + taffy.compute_layout_with_measure(node, Size::MAX_CONTENT, size_measure_function).unwrap(); assert_eq!(taffy.layout(node).unwrap().size.width, 100.0); } /// Test that adding `add_child()` works #[test] fn add_child() { - let mut taffy = Taffy::new(); + let mut taffy: Taffy<()> = Taffy::new(); let node = taffy.new_leaf(Style::default()).unwrap(); assert_eq!(taffy.child_count(node).unwrap(), 0); @@ -600,7 +643,7 @@ mod tests { #[test] fn insert_child_at_index() { - let mut taffy = Taffy::new(); + let mut taffy: Taffy<()> = Taffy::new(); let child0 = taffy.new_leaf(Style::default()).unwrap(); let child1 = taffy.new_leaf(Style::default()).unwrap(); @@ -627,7 +670,7 @@ mod tests { #[test] fn set_children() { - let mut taffy = Taffy::new(); + let mut taffy: Taffy<()> = Taffy::new(); let child0 = taffy.new_leaf(Style::default()).unwrap(); let child1 = taffy.new_leaf(Style::default()).unwrap(); @@ -649,7 +692,7 @@ mod tests { /// Test that removing a child works #[test] fn remove_child() { - let mut taffy = Taffy::new(); + let mut taffy: Taffy<()> = Taffy::new(); let child0 = taffy.new_leaf(Style::default()).unwrap(); let child1 = taffy.new_leaf(Style::default()).unwrap(); let node = taffy.new_with_children(Style::default(), &[child0, child1]).unwrap(); @@ -666,7 +709,7 @@ mod tests { #[test] fn remove_child_at_index() { - let mut taffy = Taffy::new(); + let mut taffy: Taffy<()> = Taffy::new(); let child0 = taffy.new_leaf(Style::default()).unwrap(); let child1 = taffy.new_leaf(Style::default()).unwrap(); let node = taffy.new_with_children(Style::default(), &[child0, child1]).unwrap(); @@ -684,7 +727,7 @@ mod tests { // Related to: https://github.com/DioxusLabs/taffy/issues/510 #[test] fn remove_child_updates_parents() { - let mut taffy = Taffy::new(); + let mut taffy: Taffy<()> = Taffy::new(); let parent = taffy.new_leaf(Style::default()).unwrap(); let child = taffy.new_leaf(Style::default()).unwrap(); @@ -699,7 +742,7 @@ mod tests { #[test] fn replace_child_at_index() { - let mut taffy = Taffy::new(); + let mut taffy: Taffy<()> = Taffy::new(); let child0 = taffy.new_leaf(Style::default()).unwrap(); let child1 = taffy.new_leaf(Style::default()).unwrap(); @@ -714,7 +757,7 @@ mod tests { } #[test] fn test_child_at_index() { - let mut taffy = Taffy::new(); + let mut taffy: Taffy<()> = Taffy::new(); let child0 = taffy.new_leaf(Style::default()).unwrap(); let child1 = taffy.new_leaf(Style::default()).unwrap(); let child2 = taffy.new_leaf(Style::default()).unwrap(); @@ -726,7 +769,7 @@ mod tests { } #[test] fn test_child_count() { - let mut taffy = Taffy::new(); + let mut taffy: Taffy<()> = Taffy::new(); let child0 = taffy.new_leaf(Style::default()).unwrap(); let child1 = taffy.new_leaf(Style::default()).unwrap(); let node = taffy.new_with_children(Style::default(), &[child0, child1]).unwrap(); @@ -739,7 +782,7 @@ mod tests { #[allow(clippy::vec_init_then_push)] #[test] fn test_children() { - let mut taffy = Taffy::new(); + let mut taffy: Taffy<()> = Taffy::new(); let child0 = taffy.new_leaf(Style::default()).unwrap(); let child1 = taffy.new_leaf(Style::default()).unwrap(); let node = taffy.new_with_children(Style::default(), &[child0, child1]).unwrap(); @@ -755,7 +798,7 @@ mod tests { } #[test] fn test_set_style() { - let mut taffy = Taffy::new(); + let mut taffy: Taffy<()> = Taffy::new(); let node = taffy.new_leaf(Style::default()).unwrap(); assert_eq!(taffy.style(node).unwrap().display, Display::Flex); @@ -765,7 +808,7 @@ mod tests { } #[test] fn test_style() { - let mut taffy = Taffy::new(); + let mut taffy: Taffy<()> = Taffy::new(); let style = Style { display: Display::None, flex_direction: FlexDirection::RowReverse, ..Default::default() }; @@ -777,7 +820,7 @@ mod tests { } #[test] fn test_layout() { - let mut taffy = Taffy::new(); + let mut taffy: Taffy<()> = Taffy::new(); let node = taffy.new_leaf(Style::default()).unwrap(); // TODO: Improve this test? @@ -787,7 +830,7 @@ mod tests { #[test] fn test_mark_dirty() { - let mut taffy = Taffy::new(); + let mut taffy: Taffy<()> = Taffy::new(); let child0 = taffy.new_leaf(Style::default()).unwrap(); let child1 = taffy.new_leaf(Style::default()).unwrap(); let node = taffy.new_with_children(Style::default(), &[child0, child1]).unwrap(); @@ -812,7 +855,7 @@ mod tests { #[test] fn compute_layout_should_produce_valid_result() { - let mut taffy = Taffy::new(); + let mut taffy: Taffy<()> = Taffy::new(); let node_result = taffy.new_leaf(Style { size: Size { width: Dimension::Length(10f32), height: Dimension::Length(10f32) }, ..Default::default() @@ -830,7 +873,7 @@ mod tests { fn make_sure_layout_location_is_top_left() { use crate::prelude::Rect; - let mut taffy = Taffy::new(); + let mut taffy: Taffy<()> = Taffy::new(); let node = taffy .new_leaf(Style { diff --git a/src/util/sys.rs b/src/util/sys.rs index 606313d7c..e936878db 100644 --- a/src/util/sys.rs +++ b/src/util/sys.rs @@ -15,8 +15,6 @@ pub(crate) use self::core::*; /// For when `std` is enabled #[cfg(feature = "std")] mod std { - /// An allocation-backend agnostic [`Box`] type - pub(crate) type Box = std::boxed::Box; /// An allocation-backend agnostic vector type pub(crate) type Vec = std::vec::Vec; /// A vector of child nodes @@ -60,8 +58,6 @@ mod alloc { extern crate alloc; use core::cmp::Ordering; - /// An allocation-backend agnostic `Box` type - pub(crate) type Box = alloc::boxed::Box; /// An allocation-backend agnostic vector type pub(crate) type Vec = alloc::vec::Vec; /// A vector of child nodes diff --git a/tests/border_and_padding.rs b/tests/border_and_padding.rs index a587ce7e2..84c68c6ca 100644 --- a/tests/border_and_padding.rs +++ b/tests/border_and_padding.rs @@ -9,7 +9,7 @@ fn arr_to_rect(items: [T; 4]) -> Rect { #[ignore] fn border_on_a_single_axis_doesnt_increase_size() { for i in 0..4 { - let mut taffy = Taffy::new(); + let mut taffy: Taffy<()> = Taffy::new(); let node = taffy .new_leaf(Style { border: { @@ -37,7 +37,7 @@ fn border_on_a_single_axis_doesnt_increase_size() { #[ignore] fn padding_on_a_single_axis_doesnt_increase_size() { for i in 0..4 { - let mut taffy = Taffy::new(); + let mut taffy: Taffy<()> = Taffy::new(); let node = taffy .new_leaf(Style { padding: { @@ -65,7 +65,7 @@ fn padding_on_a_single_axis_doesnt_increase_size() { #[ignore] fn border_and_padding_on_a_single_axis_doesnt_increase_size() { for i in 0..4 { - let mut taffy = Taffy::new(); + let mut taffy: Taffy<()> = Taffy::new(); let rect = { let mut lengths = [LengthPercentage::ZERO; 4]; lengths[i] = LengthPercentage::Length(10.); @@ -87,7 +87,7 @@ fn border_and_padding_on_a_single_axis_doesnt_increase_size() { #[test] #[ignore] fn vertical_border_and_padding_percentage_values_use_available_space_correctly() { - let mut taffy = Taffy::new(); + let mut taffy: Taffy<()> = Taffy::new(); let node = taffy .new_leaf(Style { diff --git a/tests/caching.rs b/tests/caching.rs index 0ef57c36b..3aba08159 100644 --- a/tests/caching.rs +++ b/tests/caching.rs @@ -1,67 +1,56 @@ #[cfg(test)] mod caching { use taffy::prelude::*; - use taffy::tree::MeasureFunc; + + struct CountMeasure { + count: usize, + } + impl CountMeasure { + fn new() -> CountMeasure { + CountMeasure { count: 0 } + } + } + + fn count_measure_function( + known_dimensions: Size>, + _available_space: Size, + _node_id: NodeId, + mut node_context: Option<&mut CountMeasure>, + ) -> Size { + node_context.as_mut().unwrap().count += 1; + Size { width: known_dimensions.width.unwrap_or(50.0), height: known_dimensions.height.unwrap_or(50.0) } + } #[test] fn measure_count_flexbox() { - use std::sync::atomic::{AtomicU32, Ordering}; - - let mut taffy = Taffy::new(); - static NUM_MEASURES: AtomicU32 = AtomicU32::new(0); + let mut taffy: Taffy = Taffy::new(); - let leaf = taffy - .new_leaf_with_measure( - Style::default(), - MeasureFunc::Raw(|known_dimensions, _available_space| { - NUM_MEASURES.fetch_add(1, Ordering::SeqCst); - Size { - width: known_dimensions.width.unwrap_or(50.0), - height: known_dimensions.height.unwrap_or(50.0), - } - }), - ) - .unwrap(); + let leaf = taffy.new_leaf_with_context(Style::default(), CountMeasure::new()).unwrap(); let mut node = taffy.new_with_children(Style::DEFAULT, &[leaf]).unwrap(); for _ in 0..100 { node = taffy.new_with_children(Style::DEFAULT, &[node]).unwrap(); } - taffy.compute_layout(node, Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, Size::MAX_CONTENT, count_measure_function).unwrap(); - assert_eq!(NUM_MEASURES.load(Ordering::SeqCst), 3); + assert_eq!(taffy.get_node_context_mut(leaf).unwrap().count, 3); } #[test] #[cfg(feature = "grid")] fn measure_count_grid() { - use std::sync::atomic::{AtomicU32, Ordering}; + let mut taffy: Taffy = Taffy::new(); let style = || Style { display: Display::Grid, ..Default::default() }; - - let mut taffy = Taffy::new(); - static NUM_MEASURES: AtomicU32 = AtomicU32::new(0); - - let leaf = taffy - .new_leaf_with_measure( - style(), - MeasureFunc::Raw(|known_dimensions, _available_space| { - NUM_MEASURES.fetch_add(1, Ordering::SeqCst); - Size { - width: known_dimensions.width.unwrap_or(50.0), - height: known_dimensions.height.unwrap_or(50.0), - } - }), - ) - .unwrap(); + let leaf = taffy.new_leaf_with_context(style(), CountMeasure::new()).unwrap(); let mut node = taffy.new_with_children(Style::DEFAULT, &[leaf]).unwrap(); for _ in 0..100 { node = taffy.new_with_children(Style::DEFAULT, &[node]).unwrap(); } - taffy.compute_layout(node, Size::MAX_CONTENT).unwrap(); - assert_eq!(NUM_MEASURES.load(Ordering::SeqCst), 3); + taffy.compute_layout_with_measure(node, Size::MAX_CONTENT, count_measure_function).unwrap(); + assert_eq!(taffy.get_node_context_mut(leaf).unwrap().count, 3); } } diff --git a/tests/fixtures.rs b/tests/fixtures.rs index e90c52e31..8f8ab3f8d 100644 --- a/tests/fixtures.rs +++ b/tests/fixtures.rs @@ -11,15 +11,22 @@ enum WritingMode { } #[allow(dead_code)] -fn measure_standard_text( - known_dimensions: taffy::geometry::Size>, - available_space: taffy::geometry::Size, - text_content: &str, +struct TextMeasure { + text_content: &'static str, writing_mode: WritingMode, _aspect_ratio: Option, +} + +#[allow(dead_code)] +fn test_measure_function( + known_dimensions: taffy::geometry::Size>, + available_space: taffy::geometry::Size, + _node_id: taffy::tree::NodeId, + node_context: Option<&mut TextMeasure>, ) -> taffy::geometry::Size { use taffy::geometry::AbsoluteAxis; use taffy::prelude::*; + const ZWS: char = '\u{200B}'; const H_WIDTH: f32 = 10.0; const H_HEIGHT: f32 = 10.0; @@ -28,13 +35,15 @@ fn measure_standard_text( return Size { width, height }; } - let inline_axis = match writing_mode { + let Some(node_context) = node_context else { return Size::ZERO }; + + let inline_axis = match node_context.writing_mode { WritingMode::Horizontal => AbsoluteAxis::Horizontal, WritingMode::Vertical => AbsoluteAxis::Vertical, }; let block_axis = inline_axis.other_axis(); + let lines: Vec<&str> = node_context.text_content.split(ZWS).collect(); - let lines: Vec<&str> = text_content.split(ZWS).collect(); if lines.is_empty() { return Size::ZERO; } @@ -66,7 +75,7 @@ fn measure_standard_text( (line_count as f32) * H_HEIGHT }); - match writing_mode { + match node_context.writing_mode { WritingMode::Horizontal => Size { width: inline_size, height: block_size }, WritingMode::Vertical => Size { width: block_size, height: inline_size }, } diff --git a/tests/generated/block/block_absolute_aspect_ratio_aspect_ratio_overrides_height_of_full_inset.rs b/tests/generated/block/block_absolute_aspect_ratio_aspect_ratio_overrides_height_of_full_inset.rs index c37bbc88a..088f80d88 100644 --- a/tests/generated/block/block_absolute_aspect_ratio_aspect_ratio_overrides_height_of_full_inset.rs +++ b/tests/generated/block/block_absolute_aspect_ratio_aspect_ratio_overrides_height_of_full_inset.rs @@ -1,8 +1,8 @@ #[test] fn block_absolute_aspect_ratio_aspect_ratio_overrides_height_of_full_inset() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -29,9 +29,9 @@ fn block_absolute_aspect_ratio_aspect_ratio_overrides_height_of_full_inset() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); diff --git a/tests/generated/block/block_absolute_aspect_ratio_fill_height.rs b/tests/generated/block/block_absolute_aspect_ratio_fill_height.rs index a3eed0050..87471dee0 100644 --- a/tests/generated/block/block_absolute_aspect_ratio_fill_height.rs +++ b/tests/generated/block/block_absolute_aspect_ratio_fill_height.rs @@ -1,8 +1,8 @@ #[test] fn block_absolute_aspect_ratio_fill_height() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -30,9 +30,9 @@ fn block_absolute_aspect_ratio_fill_height() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); diff --git a/tests/generated/block/block_absolute_aspect_ratio_fill_height_from_inset.rs b/tests/generated/block/block_absolute_aspect_ratio_fill_height_from_inset.rs index 220bb8be3..3cddb6750 100644 --- a/tests/generated/block/block_absolute_aspect_ratio_fill_height_from_inset.rs +++ b/tests/generated/block/block_absolute_aspect_ratio_fill_height_from_inset.rs @@ -1,8 +1,8 @@ #[test] fn block_absolute_aspect_ratio_fill_height_from_inset() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -29,9 +29,9 @@ fn block_absolute_aspect_ratio_fill_height_from_inset() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); diff --git a/tests/generated/block/block_absolute_aspect_ratio_fill_max_height.rs b/tests/generated/block/block_absolute_aspect_ratio_fill_max_height.rs index d90c06685..48327fe32 100644 --- a/tests/generated/block/block_absolute_aspect_ratio_fill_max_height.rs +++ b/tests/generated/block/block_absolute_aspect_ratio_fill_max_height.rs @@ -1,9 +1,9 @@ #[test] fn block_absolute_aspect_ratio_fill_max_height() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); - let node0 = taffy . new_leaf_with_measure (taffy :: style :: Style { position : taffy :: style :: Position :: Absolute , max_size : taffy :: geometry :: Size { width : taffy :: style :: Dimension :: Length (50f32) , height : auto () , } , aspect_ratio : Some (3f32) , .. Default :: default () } , taffy :: tree :: MeasureFunc :: Raw (| known_dimensions , available_space | { const TEXT : & str = "HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH" ; crate :: measure_standard_text (known_dimensions , available_space , TEXT , crate :: WritingMode :: Horizontal , Some (3f32)) }) ,) . unwrap () ; + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); + let node0 = taffy . new_leaf_with_context (taffy :: style :: Style { position : taffy :: style :: Position :: Absolute , max_size : taffy :: geometry :: Size { width : taffy :: style :: Dimension :: Length (50f32) , height : auto () , } , aspect_ratio : Some (3f32) , .. Default :: default () } , crate :: TextMeasure { text_content : "HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH" , writing_mode : crate :: WritingMode :: Horizontal , _aspect_ratio : Some (3f32) , } ,) . unwrap () ; let node = taffy .new_with_children( taffy::style::Style { @@ -17,9 +17,9 @@ fn block_absolute_aspect_ratio_fill_max_height() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); diff --git a/tests/generated/block/block_absolute_aspect_ratio_fill_max_width.rs b/tests/generated/block/block_absolute_aspect_ratio_fill_max_width.rs index a279ae243..503561e8e 100644 --- a/tests/generated/block/block_absolute_aspect_ratio_fill_max_width.rs +++ b/tests/generated/block/block_absolute_aspect_ratio_fill_max_width.rs @@ -1,9 +1,9 @@ #[test] fn block_absolute_aspect_ratio_fill_max_width() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); - let node0 = taffy . new_leaf_with_measure (taffy :: style :: Style { position : taffy :: style :: Position :: Absolute , max_size : taffy :: geometry :: Size { width : auto () , height : taffy :: style :: Dimension :: Length (50f32) , } , aspect_ratio : Some (0.5f32) , .. Default :: default () } , taffy :: tree :: MeasureFunc :: Raw (| known_dimensions , available_space | { const TEXT : & str = "HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH" ; crate :: measure_standard_text (known_dimensions , available_space , TEXT , crate :: WritingMode :: Horizontal , Some (0.5f32)) }) ,) . unwrap () ; + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); + let node0 = taffy . new_leaf_with_context (taffy :: style :: Style { position : taffy :: style :: Position :: Absolute , max_size : taffy :: geometry :: Size { width : auto () , height : taffy :: style :: Dimension :: Length (50f32) , } , aspect_ratio : Some (0.5f32) , .. Default :: default () } , crate :: TextMeasure { text_content : "HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH" , writing_mode : crate :: WritingMode :: Horizontal , _aspect_ratio : Some (0.5f32) , } ,) . unwrap () ; let node = taffy .new_with_children( taffy::style::Style { @@ -17,9 +17,9 @@ fn block_absolute_aspect_ratio_fill_max_width() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); diff --git a/tests/generated/block/block_absolute_aspect_ratio_fill_min_height.rs b/tests/generated/block/block_absolute_aspect_ratio_fill_min_height.rs index 7fdc0f3e4..03991d4c5 100644 --- a/tests/generated/block/block_absolute_aspect_ratio_fill_min_height.rs +++ b/tests/generated/block/block_absolute_aspect_ratio_fill_min_height.rs @@ -1,8 +1,8 @@ #[test] fn block_absolute_aspect_ratio_fill_min_height() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -24,9 +24,9 @@ fn block_absolute_aspect_ratio_fill_min_height() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); diff --git a/tests/generated/block/block_absolute_aspect_ratio_fill_min_width.rs b/tests/generated/block/block_absolute_aspect_ratio_fill_min_width.rs index 7854bbf11..4386cd626 100644 --- a/tests/generated/block/block_absolute_aspect_ratio_fill_min_width.rs +++ b/tests/generated/block/block_absolute_aspect_ratio_fill_min_width.rs @@ -1,8 +1,8 @@ #[test] fn block_absolute_aspect_ratio_fill_min_width() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -24,9 +24,9 @@ fn block_absolute_aspect_ratio_fill_min_width() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); diff --git a/tests/generated/block/block_absolute_aspect_ratio_fill_width.rs b/tests/generated/block/block_absolute_aspect_ratio_fill_width.rs index b95046a36..f830f3153 100644 --- a/tests/generated/block/block_absolute_aspect_ratio_fill_width.rs +++ b/tests/generated/block/block_absolute_aspect_ratio_fill_width.rs @@ -1,8 +1,8 @@ #[test] fn block_absolute_aspect_ratio_fill_width() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -30,9 +30,9 @@ fn block_absolute_aspect_ratio_fill_width() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); diff --git a/tests/generated/block/block_absolute_aspect_ratio_fill_width_from_inset.rs b/tests/generated/block/block_absolute_aspect_ratio_fill_width_from_inset.rs index 3cbc79bd8..cc9ec2370 100644 --- a/tests/generated/block/block_absolute_aspect_ratio_fill_width_from_inset.rs +++ b/tests/generated/block/block_absolute_aspect_ratio_fill_width_from_inset.rs @@ -1,8 +1,8 @@ #[test] fn block_absolute_aspect_ratio_fill_width_from_inset() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -29,9 +29,9 @@ fn block_absolute_aspect_ratio_fill_width_from_inset() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); diff --git a/tests/generated/block/block_absolute_aspect_ratio_height_overrides_inset.rs b/tests/generated/block/block_absolute_aspect_ratio_height_overrides_inset.rs index 3985d865f..6efa9a578 100644 --- a/tests/generated/block/block_absolute_aspect_ratio_height_overrides_inset.rs +++ b/tests/generated/block/block_absolute_aspect_ratio_height_overrides_inset.rs @@ -1,8 +1,8 @@ #[test] fn block_absolute_aspect_ratio_height_overrides_inset() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -30,9 +30,9 @@ fn block_absolute_aspect_ratio_height_overrides_inset() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); diff --git a/tests/generated/block/block_absolute_aspect_ratio_width_overrides_inset.rs b/tests/generated/block/block_absolute_aspect_ratio_width_overrides_inset.rs index 238d8eec7..91a63865f 100644 --- a/tests/generated/block/block_absolute_aspect_ratio_width_overrides_inset.rs +++ b/tests/generated/block/block_absolute_aspect_ratio_width_overrides_inset.rs @@ -1,8 +1,8 @@ #[test] fn block_absolute_aspect_ratio_width_overrides_inset() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -30,9 +30,9 @@ fn block_absolute_aspect_ratio_width_overrides_inset() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); diff --git a/tests/generated/block/block_absolute_child_with_margin_x.rs b/tests/generated/block/block_absolute_child_with_margin_x.rs index d36d0604f..3c575f83e 100644 --- a/tests/generated/block/block_absolute_child_with_margin_x.rs +++ b/tests/generated/block/block_absolute_child_with_margin_x.rs @@ -1,8 +1,8 @@ #[test] fn block_absolute_child_with_margin_x() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -64,9 +64,9 @@ fn block_absolute_child_with_margin_x() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); diff --git a/tests/generated/block/block_absolute_child_with_margin_y.rs b/tests/generated/block/block_absolute_child_with_margin_y.rs index 1335e48df..6baa87e67 100644 --- a/tests/generated/block/block_absolute_child_with_margin_y.rs +++ b/tests/generated/block/block_absolute_child_with_margin_y.rs @@ -1,8 +1,8 @@ #[test] fn block_absolute_child_with_margin_y() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -64,9 +64,9 @@ fn block_absolute_child_with_margin_y() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); diff --git a/tests/generated/block/block_absolute_child_with_max_height.rs b/tests/generated/block/block_absolute_child_with_max_height.rs index 142f4215b..257aba40a 100644 --- a/tests/generated/block/block_absolute_child_with_max_height.rs +++ b/tests/generated/block/block_absolute_child_with_max_height.rs @@ -1,8 +1,8 @@ #[test] fn block_absolute_child_with_max_height() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, @@ -43,9 +43,9 @@ fn block_absolute_child_with_max_height() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/block/block_absolute_layout_child_order.rs b/tests/generated/block/block_absolute_layout_child_order.rs index c5911f984..b33bea058 100644 --- a/tests/generated/block/block_absolute_layout_child_order.rs +++ b/tests/generated/block/block_absolute_layout_child_order.rs @@ -1,8 +1,8 @@ #[test] fn block_absolute_layout_child_order() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, @@ -49,9 +49,9 @@ fn block_absolute_layout_child_order() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 110f32, "width of node {:?}. Expected {}. Actual {}", node, 110f32, size.width); diff --git a/tests/generated/block/block_absolute_layout_no_size.rs b/tests/generated/block/block_absolute_layout_no_size.rs index cdd22b481..d4eb76380 100644 --- a/tests/generated/block/block_absolute_layout_no_size.rs +++ b/tests/generated/block/block_absolute_layout_no_size.rs @@ -1,8 +1,8 @@ #[test] fn block_absolute_layout_no_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, ..Default::default() }) .unwrap(); @@ -19,9 +19,9 @@ fn block_absolute_layout_no_size() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/block/block_absolute_layout_percentage_bottom_based_on_parent_height.rs b/tests/generated/block/block_absolute_layout_percentage_bottom_based_on_parent_height.rs index 22b5394c4..e9bfe196c 100644 --- a/tests/generated/block/block_absolute_layout_percentage_bottom_based_on_parent_height.rs +++ b/tests/generated/block/block_absolute_layout_percentage_bottom_based_on_parent_height.rs @@ -1,8 +1,8 @@ #[test] fn block_absolute_layout_percentage_bottom_based_on_parent_height() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, @@ -64,9 +64,9 @@ fn block_absolute_layout_percentage_bottom_based_on_parent_height() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/block/block_absolute_layout_percentage_height.rs b/tests/generated/block/block_absolute_layout_percentage_height.rs index 5f143acce..cd6fcc5b0 100644 --- a/tests/generated/block/block_absolute_layout_percentage_height.rs +++ b/tests/generated/block/block_absolute_layout_percentage_height.rs @@ -1,8 +1,8 @@ #[test] fn block_absolute_layout_percentage_height() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -32,9 +32,9 @@ fn block_absolute_layout_percentage_height() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/block/block_absolute_layout_row_width_height_end_bottom.rs b/tests/generated/block/block_absolute_layout_row_width_height_end_bottom.rs index 0638686c0..402e62043 100644 --- a/tests/generated/block/block_absolute_layout_row_width_height_end_bottom.rs +++ b/tests/generated/block/block_absolute_layout_row_width_height_end_bottom.rs @@ -1,8 +1,8 @@ #[test] fn block_absolute_layout_row_width_height_end_bottom() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -32,9 +32,9 @@ fn block_absolute_layout_row_width_height_end_bottom() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/block/block_absolute_layout_start_top_end_bottom.rs b/tests/generated/block/block_absolute_layout_start_top_end_bottom.rs index 5a59113fc..41db81176 100644 --- a/tests/generated/block/block_absolute_layout_start_top_end_bottom.rs +++ b/tests/generated/block/block_absolute_layout_start_top_end_bottom.rs @@ -1,8 +1,8 @@ #[test] fn block_absolute_layout_start_top_end_bottom() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, @@ -29,9 +29,9 @@ fn block_absolute_layout_start_top_end_bottom() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/block/block_absolute_layout_width_height_end_bottom.rs b/tests/generated/block/block_absolute_layout_width_height_end_bottom.rs index 4de4f947f..4f3b93cc2 100644 --- a/tests/generated/block/block_absolute_layout_width_height_end_bottom.rs +++ b/tests/generated/block/block_absolute_layout_width_height_end_bottom.rs @@ -1,8 +1,8 @@ #[test] fn block_absolute_layout_width_height_end_bottom() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, @@ -33,9 +33,9 @@ fn block_absolute_layout_width_height_end_bottom() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/block/block_absolute_layout_width_height_start_top.rs b/tests/generated/block/block_absolute_layout_width_height_start_top.rs index e55740f7c..646cfc8dd 100644 --- a/tests/generated/block/block_absolute_layout_width_height_start_top.rs +++ b/tests/generated/block/block_absolute_layout_width_height_start_top.rs @@ -1,8 +1,8 @@ #[test] fn block_absolute_layout_width_height_start_top() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, @@ -33,9 +33,9 @@ fn block_absolute_layout_width_height_start_top() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/block/block_absolute_layout_width_height_start_top_end_bottom.rs b/tests/generated/block/block_absolute_layout_width_height_start_top_end_bottom.rs index aee1745d3..5a100ad4f 100644 --- a/tests/generated/block/block_absolute_layout_width_height_start_top_end_bottom.rs +++ b/tests/generated/block/block_absolute_layout_width_height_start_top_end_bottom.rs @@ -1,8 +1,8 @@ #[test] fn block_absolute_layout_width_height_start_top_end_bottom() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, @@ -33,9 +33,9 @@ fn block_absolute_layout_width_height_start_top_end_bottom() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/block/block_absolute_layout_within_border.rs b/tests/generated/block/block_absolute_layout_within_border.rs index c673cc758..6f6341152 100644 --- a/tests/generated/block/block_absolute_layout_within_border.rs +++ b/tests/generated/block/block_absolute_layout_within_border.rs @@ -1,8 +1,8 @@ #[test] fn block_absolute_layout_within_border() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, @@ -108,9 +108,9 @@ fn block_absolute_layout_within_border() { &[node0, node1, node2, node3], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/block/block_absolute_margin_auto_bottom_and_top_with_inset.rs b/tests/generated/block/block_absolute_margin_auto_bottom_and_top_with_inset.rs index 7c50eae88..e3c91a1e7 100644 --- a/tests/generated/block/block_absolute_margin_auto_bottom_and_top_with_inset.rs +++ b/tests/generated/block/block_absolute_margin_auto_bottom_and_top_with_inset.rs @@ -1,8 +1,8 @@ #[test] fn block_absolute_margin_auto_bottom_and_top_with_inset() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -38,9 +38,9 @@ fn block_absolute_margin_auto_bottom_and_top_with_inset() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/block/block_absolute_margin_auto_bottom_and_top_without_inset.rs b/tests/generated/block/block_absolute_margin_auto_bottom_and_top_without_inset.rs index 0a7fb19da..6528c076d 100644 --- a/tests/generated/block/block_absolute_margin_auto_bottom_and_top_without_inset.rs +++ b/tests/generated/block/block_absolute_margin_auto_bottom_and_top_without_inset.rs @@ -1,8 +1,8 @@ #[test] fn block_absolute_margin_auto_bottom_and_top_without_inset() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -32,9 +32,9 @@ fn block_absolute_margin_auto_bottom_and_top_without_inset() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/block/block_absolute_margin_auto_bottom_with_inset.rs b/tests/generated/block/block_absolute_margin_auto_bottom_with_inset.rs index 14e22f8fc..fc5ef0de3 100644 --- a/tests/generated/block/block_absolute_margin_auto_bottom_with_inset.rs +++ b/tests/generated/block/block_absolute_margin_auto_bottom_with_inset.rs @@ -1,8 +1,8 @@ #[test] fn block_absolute_margin_auto_bottom_with_inset() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -39,9 +39,9 @@ fn block_absolute_margin_auto_bottom_with_inset() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/block/block_absolute_margin_auto_bottom_without_inset.rs b/tests/generated/block/block_absolute_margin_auto_bottom_without_inset.rs index ad1df5680..02055523c 100644 --- a/tests/generated/block/block_absolute_margin_auto_bottom_without_inset.rs +++ b/tests/generated/block/block_absolute_margin_auto_bottom_without_inset.rs @@ -1,8 +1,8 @@ #[test] fn block_absolute_margin_auto_bottom_without_inset() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -33,9 +33,9 @@ fn block_absolute_margin_auto_bottom_without_inset() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/block/block_absolute_margin_auto_left_and_right_with_inset.rs b/tests/generated/block/block_absolute_margin_auto_left_and_right_with_inset.rs index 273b0a825..9cbe7b45d 100644 --- a/tests/generated/block/block_absolute_margin_auto_left_and_right_with_inset.rs +++ b/tests/generated/block/block_absolute_margin_auto_left_and_right_with_inset.rs @@ -1,8 +1,8 @@ #[test] fn block_absolute_margin_auto_left_and_right_with_inset() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -38,9 +38,9 @@ fn block_absolute_margin_auto_left_and_right_with_inset() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/block/block_absolute_margin_auto_left_and_right_without_inset.rs b/tests/generated/block/block_absolute_margin_auto_left_and_right_without_inset.rs index 9c0853223..fc0951019 100644 --- a/tests/generated/block/block_absolute_margin_auto_left_and_right_without_inset.rs +++ b/tests/generated/block/block_absolute_margin_auto_left_and_right_without_inset.rs @@ -1,8 +1,8 @@ #[test] fn block_absolute_margin_auto_left_and_right_without_inset() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -32,9 +32,9 @@ fn block_absolute_margin_auto_left_and_right_without_inset() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/block/block_absolute_margin_auto_left_child_bigger_than_parent_with_inset.rs b/tests/generated/block/block_absolute_margin_auto_left_child_bigger_than_parent_with_inset.rs index 73b49dab4..bbf43c71a 100644 --- a/tests/generated/block/block_absolute_margin_auto_left_child_bigger_than_parent_with_inset.rs +++ b/tests/generated/block/block_absolute_margin_auto_left_child_bigger_than_parent_with_inset.rs @@ -1,8 +1,8 @@ #[test] fn block_absolute_margin_auto_left_child_bigger_than_parent_with_inset() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -38,9 +38,9 @@ fn block_absolute_margin_auto_left_child_bigger_than_parent_with_inset() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 52f32, "width of node {:?}. Expected {}. Actual {}", node, 52f32, size.width); diff --git a/tests/generated/block/block_absolute_margin_auto_left_child_bigger_than_parent_without_inset.rs b/tests/generated/block/block_absolute_margin_auto_left_child_bigger_than_parent_without_inset.rs index 9b7a5acbd..5a30fdf85 100644 --- a/tests/generated/block/block_absolute_margin_auto_left_child_bigger_than_parent_without_inset.rs +++ b/tests/generated/block/block_absolute_margin_auto_left_child_bigger_than_parent_without_inset.rs @@ -1,8 +1,8 @@ #[test] fn block_absolute_margin_auto_left_child_bigger_than_parent_without_inset() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -32,9 +32,9 @@ fn block_absolute_margin_auto_left_child_bigger_than_parent_without_inset() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 52f32, "width of node {:?}. Expected {}. Actual {}", node, 52f32, size.width); diff --git a/tests/generated/block/block_absolute_margin_auto_left_fix_right_child_bigger_than_parent_with_inset.rs b/tests/generated/block/block_absolute_margin_auto_left_fix_right_child_bigger_than_parent_with_inset.rs index 643e99dba..ae4ddcc10 100644 --- a/tests/generated/block/block_absolute_margin_auto_left_fix_right_child_bigger_than_parent_with_inset.rs +++ b/tests/generated/block/block_absolute_margin_auto_left_fix_right_child_bigger_than_parent_with_inset.rs @@ -1,8 +1,8 @@ #[test] fn block_absolute_margin_auto_left_fix_right_child_bigger_than_parent_with_inset() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -38,9 +38,9 @@ fn block_absolute_margin_auto_left_fix_right_child_bigger_than_parent_with_inset &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 52f32, "width of node {:?}. Expected {}. Actual {}", node, 52f32, size.width); diff --git a/tests/generated/block/block_absolute_margin_auto_left_fix_right_child_bigger_than_parent_without_inset.rs b/tests/generated/block/block_absolute_margin_auto_left_fix_right_child_bigger_than_parent_without_inset.rs index a9bc7015a..7c0de44b2 100644 --- a/tests/generated/block/block_absolute_margin_auto_left_fix_right_child_bigger_than_parent_without_inset.rs +++ b/tests/generated/block/block_absolute_margin_auto_left_fix_right_child_bigger_than_parent_without_inset.rs @@ -1,8 +1,8 @@ #[test] fn block_absolute_margin_auto_left_fix_right_child_bigger_than_parent_without_inset() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -32,9 +32,9 @@ fn block_absolute_margin_auto_left_fix_right_child_bigger_than_parent_without_in &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 52f32, "width of node {:?}. Expected {}. Actual {}", node, 52f32, size.width); diff --git a/tests/generated/block/block_absolute_margin_auto_left_right_child_bigger_than_parent_with_inset.rs b/tests/generated/block/block_absolute_margin_auto_left_right_child_bigger_than_parent_with_inset.rs index b727a997d..33b7b1e18 100644 --- a/tests/generated/block/block_absolute_margin_auto_left_right_child_bigger_than_parent_with_inset.rs +++ b/tests/generated/block/block_absolute_margin_auto_left_right_child_bigger_than_parent_with_inset.rs @@ -1,8 +1,8 @@ #[test] fn block_absolute_margin_auto_left_right_child_bigger_than_parent_with_inset() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -38,9 +38,9 @@ fn block_absolute_margin_auto_left_right_child_bigger_than_parent_with_inset() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 52f32, "width of node {:?}. Expected {}. Actual {}", node, 52f32, size.width); diff --git a/tests/generated/block/block_absolute_margin_auto_left_right_child_bigger_than_parent_without_inset.rs b/tests/generated/block/block_absolute_margin_auto_left_right_child_bigger_than_parent_without_inset.rs index f514561fa..870365396 100644 --- a/tests/generated/block/block_absolute_margin_auto_left_right_child_bigger_than_parent_without_inset.rs +++ b/tests/generated/block/block_absolute_margin_auto_left_right_child_bigger_than_parent_without_inset.rs @@ -1,8 +1,8 @@ #[test] fn block_absolute_margin_auto_left_right_child_bigger_than_parent_without_inset() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -32,9 +32,9 @@ fn block_absolute_margin_auto_left_right_child_bigger_than_parent_without_inset( &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 52f32, "width of node {:?}. Expected {}. Actual {}", node, 52f32, size.width); diff --git a/tests/generated/block/block_absolute_margin_auto_left_with_inset.rs b/tests/generated/block/block_absolute_margin_auto_left_with_inset.rs index 904359fad..deb858ca1 100644 --- a/tests/generated/block/block_absolute_margin_auto_left_with_inset.rs +++ b/tests/generated/block/block_absolute_margin_auto_left_with_inset.rs @@ -1,8 +1,8 @@ #[test] fn block_absolute_margin_auto_left_with_inset() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -38,9 +38,9 @@ fn block_absolute_margin_auto_left_with_inset() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/block/block_absolute_margin_auto_left_without_inset.rs b/tests/generated/block/block_absolute_margin_auto_left_without_inset.rs index 31f34b4bf..203956f48 100644 --- a/tests/generated/block/block_absolute_margin_auto_left_without_inset.rs +++ b/tests/generated/block/block_absolute_margin_auto_left_without_inset.rs @@ -1,8 +1,8 @@ #[test] fn block_absolute_margin_auto_left_without_inset() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -32,9 +32,9 @@ fn block_absolute_margin_auto_left_without_inset() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/block/block_absolute_margin_auto_mutiple_children_with_inset.rs b/tests/generated/block/block_absolute_margin_auto_mutiple_children_with_inset.rs index aa6ebbfef..90614e3cc 100644 --- a/tests/generated/block/block_absolute_margin_auto_mutiple_children_with_inset.rs +++ b/tests/generated/block/block_absolute_margin_auto_mutiple_children_with_inset.rs @@ -1,8 +1,8 @@ #[test] fn block_absolute_margin_auto_mutiple_children_with_inset() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -61,9 +61,9 @@ fn block_absolute_margin_auto_mutiple_children_with_inset() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/block/block_absolute_margin_auto_mutiple_children_without_inset.rs b/tests/generated/block/block_absolute_margin_auto_mutiple_children_without_inset.rs index 58767e1dc..ba661d97e 100644 --- a/tests/generated/block/block_absolute_margin_auto_mutiple_children_without_inset.rs +++ b/tests/generated/block/block_absolute_margin_auto_mutiple_children_without_inset.rs @@ -1,8 +1,8 @@ #[test] fn block_absolute_margin_auto_mutiple_children_without_inset() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -49,9 +49,9 @@ fn block_absolute_margin_auto_mutiple_children_without_inset() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/block/block_absolute_margin_auto_right_with_inset.rs b/tests/generated/block/block_absolute_margin_auto_right_with_inset.rs index 920946a8e..448e351c1 100644 --- a/tests/generated/block/block_absolute_margin_auto_right_with_inset.rs +++ b/tests/generated/block/block_absolute_margin_auto_right_with_inset.rs @@ -1,8 +1,8 @@ #[test] fn block_absolute_margin_auto_right_with_inset() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -39,9 +39,9 @@ fn block_absolute_margin_auto_right_with_inset() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/block/block_absolute_margin_auto_right_without_inset.rs b/tests/generated/block/block_absolute_margin_auto_right_without_inset.rs index b673f88f3..59ed00d96 100644 --- a/tests/generated/block/block_absolute_margin_auto_right_without_inset.rs +++ b/tests/generated/block/block_absolute_margin_auto_right_without_inset.rs @@ -1,8 +1,8 @@ #[test] fn block_absolute_margin_auto_right_without_inset() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -33,9 +33,9 @@ fn block_absolute_margin_auto_right_without_inset() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/block/block_absolute_margin_auto_top_with_inset.rs b/tests/generated/block/block_absolute_margin_auto_top_with_inset.rs index 2158dde4e..3930c3110 100644 --- a/tests/generated/block/block_absolute_margin_auto_top_with_inset.rs +++ b/tests/generated/block/block_absolute_margin_auto_top_with_inset.rs @@ -1,8 +1,8 @@ #[test] fn block_absolute_margin_auto_top_with_inset() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -39,9 +39,9 @@ fn block_absolute_margin_auto_top_with_inset() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/block/block_absolute_margin_auto_top_without_inset.rs b/tests/generated/block/block_absolute_margin_auto_top_without_inset.rs index 7860fa9a7..ddce7d328 100644 --- a/tests/generated/block/block_absolute_margin_auto_top_without_inset.rs +++ b/tests/generated/block/block_absolute_margin_auto_top_without_inset.rs @@ -1,8 +1,8 @@ #[test] fn block_absolute_margin_auto_top_without_inset() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -33,9 +33,9 @@ fn block_absolute_margin_auto_top_without_inset() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/block/block_absolute_margin_bottom_left_with_inset.rs b/tests/generated/block/block_absolute_margin_bottom_left_with_inset.rs index bc959d7e8..921a7755f 100644 --- a/tests/generated/block/block_absolute_margin_bottom_left_with_inset.rs +++ b/tests/generated/block/block_absolute_margin_bottom_left_with_inset.rs @@ -1,8 +1,8 @@ #[test] fn block_absolute_margin_bottom_left_with_inset() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, @@ -39,9 +39,9 @@ fn block_absolute_margin_bottom_left_with_inset() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/block/block_absolute_margin_bottom_left_without_inset.rs b/tests/generated/block/block_absolute_margin_bottom_left_without_inset.rs index a84e74f53..bd54fad5a 100644 --- a/tests/generated/block/block_absolute_margin_bottom_left_without_inset.rs +++ b/tests/generated/block/block_absolute_margin_bottom_left_without_inset.rs @@ -1,8 +1,8 @@ #[test] fn block_absolute_margin_bottom_left_without_inset() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, @@ -33,9 +33,9 @@ fn block_absolute_margin_bottom_left_without_inset() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/block/block_absolute_minmax_bottom_right_max.rs b/tests/generated/block/block_absolute_minmax_bottom_right_max.rs index 45969feff..49ac08a7a 100644 --- a/tests/generated/block/block_absolute_minmax_bottom_right_max.rs +++ b/tests/generated/block/block_absolute_minmax_bottom_right_max.rs @@ -1,8 +1,8 @@ #[test] fn block_absolute_minmax_bottom_right_max() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, @@ -37,9 +37,9 @@ fn block_absolute_minmax_bottom_right_max() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/block/block_absolute_minmax_bottom_right_min_max.rs b/tests/generated/block/block_absolute_minmax_bottom_right_min_max.rs index 50a625d5d..e7299806b 100644 --- a/tests/generated/block/block_absolute_minmax_bottom_right_min_max.rs +++ b/tests/generated/block/block_absolute_minmax_bottom_right_min_max.rs @@ -1,8 +1,8 @@ #[test] fn block_absolute_minmax_bottom_right_min_max() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, @@ -37,9 +37,9 @@ fn block_absolute_minmax_bottom_right_min_max() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/block/block_absolute_minmax_bottom_right_min_max_preferred.rs b/tests/generated/block/block_absolute_minmax_bottom_right_min_max_preferred.rs index 33d229e65..b777ab686 100644 --- a/tests/generated/block/block_absolute_minmax_bottom_right_min_max_preferred.rs +++ b/tests/generated/block/block_absolute_minmax_bottom_right_min_max_preferred.rs @@ -1,8 +1,8 @@ #[test] fn block_absolute_minmax_bottom_right_min_max_preferred() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, @@ -41,9 +41,9 @@ fn block_absolute_minmax_bottom_right_min_max_preferred() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/block/block_absolute_minmax_top_left_bottom_right_max.rs b/tests/generated/block/block_absolute_minmax_top_left_bottom_right_max.rs index 7ce62f469..07578ec01 100644 --- a/tests/generated/block/block_absolute_minmax_top_left_bottom_right_max.rs +++ b/tests/generated/block/block_absolute_minmax_top_left_bottom_right_max.rs @@ -1,8 +1,8 @@ #[test] fn block_absolute_minmax_top_left_bottom_right_max() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, @@ -33,9 +33,9 @@ fn block_absolute_minmax_top_left_bottom_right_max() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/block/block_absolute_minmax_top_left_bottom_right_min_max.rs b/tests/generated/block/block_absolute_minmax_top_left_bottom_right_min_max.rs index e9e9e9c04..4b7946001 100644 --- a/tests/generated/block/block_absolute_minmax_top_left_bottom_right_min_max.rs +++ b/tests/generated/block/block_absolute_minmax_top_left_bottom_right_min_max.rs @@ -1,8 +1,8 @@ #[test] fn block_absolute_minmax_top_left_bottom_right_min_max() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, @@ -37,9 +37,9 @@ fn block_absolute_minmax_top_left_bottom_right_min_max() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/block/block_absolute_no_styles.rs b/tests/generated/block/block_absolute_no_styles.rs index 2478f4bef..31c0fef29 100644 --- a/tests/generated/block/block_absolute_no_styles.rs +++ b/tests/generated/block/block_absolute_no_styles.rs @@ -1,8 +1,8 @@ #[test] fn block_absolute_no_styles() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, @@ -26,9 +26,9 @@ fn block_absolute_no_styles() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_absolute_padding_border_overrides_max_size.rs b/tests/generated/block/block_absolute_padding_border_overrides_max_size.rs index bd8dcf31f..6827d45f7 100644 --- a/tests/generated/block/block_absolute_padding_border_overrides_max_size.rs +++ b/tests/generated/block/block_absolute_padding_border_overrides_max_size.rs @@ -1,8 +1,8 @@ #[test] fn block_absolute_padding_border_overrides_max_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, @@ -32,9 +32,9 @@ fn block_absolute_padding_border_overrides_max_size() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); diff --git a/tests/generated/block/block_absolute_padding_border_overrides_size.rs b/tests/generated/block/block_absolute_padding_border_overrides_size.rs index 04a024586..1baccc5f7 100644 --- a/tests/generated/block/block_absolute_padding_border_overrides_size.rs +++ b/tests/generated/block/block_absolute_padding_border_overrides_size.rs @@ -1,8 +1,8 @@ #[test] fn block_absolute_padding_border_overrides_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, @@ -32,9 +32,9 @@ fn block_absolute_padding_border_overrides_size() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); diff --git a/tests/generated/block/block_align_baseline_child.rs b/tests/generated/block/block_align_baseline_child.rs index 1b42bf131..a4954ccfa 100644 --- a/tests/generated/block/block_align_baseline_child.rs +++ b/tests/generated/block/block_align_baseline_child.rs @@ -1,8 +1,8 @@ #[test] fn block_align_baseline_child() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, @@ -48,9 +48,9 @@ fn block_align_baseline_child() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/block/block_align_baseline_child_margin.rs b/tests/generated/block/block_align_baseline_child_margin.rs index f1e87dd80..0903794de 100644 --- a/tests/generated/block/block_align_baseline_child_margin.rs +++ b/tests/generated/block/block_align_baseline_child_margin.rs @@ -1,8 +1,8 @@ #[test] fn block_align_baseline_child_margin() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, @@ -60,9 +60,9 @@ fn block_align_baseline_child_margin() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/block/block_align_baseline_child_margin_percent.rs b/tests/generated/block/block_align_baseline_child_margin_percent.rs index ef8e9fb8d..73f78c0ac 100644 --- a/tests/generated/block/block_align_baseline_child_margin_percent.rs +++ b/tests/generated/block/block_align_baseline_child_margin_percent.rs @@ -1,8 +1,8 @@ #[test] fn block_align_baseline_child_margin_percent() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, @@ -61,9 +61,9 @@ fn block_align_baseline_child_margin_percent() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/block/block_align_baseline_child_padding.rs b/tests/generated/block/block_align_baseline_child_padding.rs index 59748057f..2129714b7 100644 --- a/tests/generated/block/block_align_baseline_child_padding.rs +++ b/tests/generated/block/block_align_baseline_child_padding.rs @@ -1,8 +1,8 @@ #[test] fn block_align_baseline_child_padding() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, @@ -61,9 +61,9 @@ fn block_align_baseline_child_padding() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/block/block_align_baseline_child_top.rs b/tests/generated/block/block_align_baseline_child_top.rs index 287a89fc3..f24b21bb8 100644 --- a/tests/generated/block/block_align_baseline_child_top.rs +++ b/tests/generated/block/block_align_baseline_child_top.rs @@ -1,8 +1,8 @@ #[test] fn block_align_baseline_child_top() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, @@ -55,9 +55,9 @@ fn block_align_baseline_child_top() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/block/block_align_baseline_child_top2.rs b/tests/generated/block/block_align_baseline_child_top2.rs index dd939c46a..061d43d7a 100644 --- a/tests/generated/block/block_align_baseline_child_top2.rs +++ b/tests/generated/block/block_align_baseline_child_top2.rs @@ -1,8 +1,8 @@ #[test] fn block_align_baseline_child_top2() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, @@ -55,9 +55,9 @@ fn block_align_baseline_child_top2() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/block/block_align_baseline_double_nested_child.rs b/tests/generated/block/block_align_baseline_double_nested_child.rs index e1a883882..a8b315f66 100644 --- a/tests/generated/block/block_align_baseline_double_nested_child.rs +++ b/tests/generated/block/block_align_baseline_double_nested_child.rs @@ -1,8 +1,8 @@ #[test] fn block_align_baseline_double_nested_child() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, @@ -62,9 +62,9 @@ fn block_align_baseline_double_nested_child() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/block/block_aspect_ratio_fill_height.rs b/tests/generated/block/block_aspect_ratio_fill_height.rs index b16fcf530..150773cea 100644 --- a/tests/generated/block/block_aspect_ratio_fill_height.rs +++ b/tests/generated/block/block_aspect_ratio_fill_height.rs @@ -1,8 +1,8 @@ #[test] fn block_aspect_ratio_fill_height() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, @@ -24,9 +24,9 @@ fn block_aspect_ratio_fill_height() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/block/block_aspect_ratio_fill_max_height.rs b/tests/generated/block/block_aspect_ratio_fill_max_height.rs index 83cdd48f3..14aeea87b 100644 --- a/tests/generated/block/block_aspect_ratio_fill_max_height.rs +++ b/tests/generated/block/block_aspect_ratio_fill_max_height.rs @@ -1,9 +1,9 @@ #[test] fn block_aspect_ratio_fill_max_height() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); - let node0 = taffy . new_leaf_with_measure (taffy :: style :: Style { display : taffy :: style :: Display :: Block , max_size : taffy :: geometry :: Size { width : taffy :: style :: Dimension :: Length (40f32) , height : auto () , } , aspect_ratio : Some (2f32) , .. Default :: default () } , taffy :: tree :: MeasureFunc :: Raw (| known_dimensions , available_space | { const TEXT : & str = "HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH" ; crate :: measure_standard_text (known_dimensions , available_space , TEXT , crate :: WritingMode :: Horizontal , Some (2f32)) }) ,) . unwrap () ; + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); + let node0 = taffy . new_leaf_with_context (taffy :: style :: Style { display : taffy :: style :: Display :: Block , max_size : taffy :: geometry :: Size { width : taffy :: style :: Dimension :: Length (40f32) , height : auto () , } , aspect_ratio : Some (2f32) , .. Default :: default () } , crate :: TextMeasure { text_content : "HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH" , writing_mode : crate :: WritingMode :: Horizontal , _aspect_ratio : Some (2f32) , } ,) . unwrap () ; let node = taffy .new_with_children( taffy::style::Style { @@ -17,9 +17,9 @@ fn block_aspect_ratio_fill_max_height() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/block/block_aspect_ratio_fill_max_width.rs b/tests/generated/block/block_aspect_ratio_fill_max_width.rs index 6b706b5fe..ecfdcde3a 100644 --- a/tests/generated/block/block_aspect_ratio_fill_max_width.rs +++ b/tests/generated/block/block_aspect_ratio_fill_max_width.rs @@ -1,26 +1,21 @@ #[test] fn block_aspect_ratio_fill_max_width() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { display: taffy::style::Display::Block, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(20f32) }, aspect_ratio: Some(2f32), ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH\u{200b}HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - Some(2f32), - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH\u{200b}HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: Some(2f32), + }, ) .unwrap(); let node = taffy @@ -36,9 +31,9 @@ fn block_aspect_ratio_fill_max_width() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/block/block_aspect_ratio_fill_min_height.rs b/tests/generated/block/block_aspect_ratio_fill_min_height.rs index d0c2cc3e3..735ca7a50 100644 --- a/tests/generated/block/block_aspect_ratio_fill_min_height.rs +++ b/tests/generated/block/block_aspect_ratio_fill_min_height.rs @@ -1,8 +1,8 @@ #[test] fn block_aspect_ratio_fill_min_height() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, @@ -24,9 +24,9 @@ fn block_aspect_ratio_fill_min_height() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/block/block_aspect_ratio_fill_min_width.rs b/tests/generated/block/block_aspect_ratio_fill_min_width.rs index b88d75c50..d7a3b4ae8 100644 --- a/tests/generated/block/block_aspect_ratio_fill_min_width.rs +++ b/tests/generated/block/block_aspect_ratio_fill_min_width.rs @@ -1,26 +1,21 @@ #[test] fn block_aspect_ratio_fill_min_width() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { display: taffy::style::Display::Block, min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(40f32) }, aspect_ratio: Some(2f32), ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "\n \n "; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - Some(2f32), - ) - }), + crate::TextMeasure { + text_content: "\n \n ", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: Some(2f32), + }, ) .unwrap(); let node = taffy @@ -36,9 +31,9 @@ fn block_aspect_ratio_fill_min_width() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/block/block_aspect_ratio_fill_width.rs b/tests/generated/block/block_aspect_ratio_fill_width.rs index a8244c1e1..4445f5fc2 100644 --- a/tests/generated/block/block_aspect_ratio_fill_width.rs +++ b/tests/generated/block/block_aspect_ratio_fill_width.rs @@ -1,8 +1,8 @@ #[test] fn block_aspect_ratio_fill_width() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, @@ -24,9 +24,9 @@ fn block_aspect_ratio_fill_width() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/block/block_basic.rs b/tests/generated/block/block_basic.rs index b7a9f22a9..d70f2c669 100644 --- a/tests/generated/block/block_basic.rs +++ b/tests/generated/block/block_basic.rs @@ -1,8 +1,8 @@ #[test] fn block_basic() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -25,9 +25,9 @@ fn block_basic() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_border_fixed_size.rs b/tests/generated/block/block_border_fixed_size.rs index 519f70fd6..ab28ea878 100644 --- a/tests/generated/block/block_border_fixed_size.rs +++ b/tests/generated/block/block_border_fixed_size.rs @@ -1,8 +1,8 @@ #[test] fn block_border_fixed_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -34,9 +34,9 @@ fn block_border_fixed_size() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_border_intrinsic_size.rs b/tests/generated/block/block_border_intrinsic_size.rs index 1e3bf3dbc..8d63bad11 100644 --- a/tests/generated/block/block_border_intrinsic_size.rs +++ b/tests/generated/block/block_border_intrinsic_size.rs @@ -1,8 +1,8 @@ #[test] fn block_border_intrinsic_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -33,9 +33,9 @@ fn block_border_intrinsic_size() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 62f32, "width of node {:?}. Expected {}. Actual {}", node, 62f32, size.width); diff --git a/tests/generated/block/block_border_percentage_fixed_size.rs b/tests/generated/block/block_border_percentage_fixed_size.rs index e612a0701..56574db3b 100644 --- a/tests/generated/block/block_border_percentage_fixed_size.rs +++ b/tests/generated/block/block_border_percentage_fixed_size.rs @@ -1,8 +1,8 @@ #[test] fn block_border_percentage_fixed_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, @@ -29,9 +29,9 @@ fn block_border_percentage_fixed_size() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_border_percentage_intrinsic_size.rs b/tests/generated/block/block_border_percentage_intrinsic_size.rs index 2fc238a25..737382572 100644 --- a/tests/generated/block/block_border_percentage_intrinsic_size.rs +++ b/tests/generated/block/block_border_percentage_intrinsic_size.rs @@ -1,8 +1,8 @@ #[test] fn block_border_percentage_intrinsic_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, @@ -22,9 +22,9 @@ fn block_border_percentage_intrinsic_size() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); diff --git a/tests/generated/block/block_display_none.rs b/tests/generated/block/block_display_none.rs index 1d2864acc..73de8678c 100644 --- a/tests/generated/block/block_display_none.rs +++ b/tests/generated/block/block_display_none.rs @@ -1,8 +1,8 @@ #[test] fn block_display_none() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -32,9 +32,9 @@ fn block_display_none() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_display_none_with_child.rs b/tests/generated/block/block_display_none_with_child.rs index 54efcada0..0520e1af3 100644 --- a/tests/generated/block/block_display_none_with_child.rs +++ b/tests/generated/block/block_display_none_with_child.rs @@ -1,8 +1,8 @@ #[test] fn block_display_none_with_child() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -43,9 +43,9 @@ fn block_display_none_with_child() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/block/block_display_none_with_inset.rs b/tests/generated/block/block_display_none_with_inset.rs index 6ea59e911..597716463 100644 --- a/tests/generated/block/block_display_none_with_inset.rs +++ b/tests/generated/block/block_display_none_with_inset.rs @@ -1,8 +1,8 @@ #[test] fn block_display_none_with_inset() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -35,9 +35,9 @@ fn block_display_none_with_inset() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/block/block_display_none_with_margin.rs b/tests/generated/block/block_display_none_with_margin.rs index a2d0c4191..bd939d7c3 100644 --- a/tests/generated/block/block_display_none_with_margin.rs +++ b/tests/generated/block/block_display_none_with_margin.rs @@ -1,8 +1,8 @@ #[test] fn block_display_none_with_margin() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::None, @@ -38,9 +38,9 @@ fn block_display_none_with_margin() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/block/block_display_none_with_position_absolute.rs b/tests/generated/block/block_display_none_with_position_absolute.rs index 07cd31902..58e37a4bc 100644 --- a/tests/generated/block/block_display_none_with_position_absolute.rs +++ b/tests/generated/block/block_display_none_with_position_absolute.rs @@ -1,8 +1,8 @@ #[test] fn block_display_none_with_position_absolute() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::None, @@ -27,9 +27,9 @@ fn block_display_none_with_position_absolute() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/block/block_inset_fixed.rs b/tests/generated/block/block_inset_fixed.rs index 191c3d697..bf3746ff0 100644 --- a/tests/generated/block/block_inset_fixed.rs +++ b/tests/generated/block/block_inset_fixed.rs @@ -1,8 +1,8 @@ #[test] fn block_inset_fixed() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -49,9 +49,9 @@ fn block_inset_fixed() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_inset_percentage.rs b/tests/generated/block/block_inset_percentage.rs index 2f978ae3f..4ea8d9b8b 100644 --- a/tests/generated/block/block_inset_percentage.rs +++ b/tests/generated/block/block_inset_percentage.rs @@ -1,8 +1,8 @@ #[test] fn block_inset_percentage() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -49,9 +49,9 @@ fn block_inset_percentage() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_intrinsic_width.rs b/tests/generated/block/block_intrinsic_width.rs index 1e31bf910..002618f0f 100644 --- a/tests/generated/block/block_intrinsic_width.rs +++ b/tests/generated/block/block_intrinsic_width.rs @@ -1,8 +1,8 @@ #[test] fn block_intrinsic_width() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -24,9 +24,9 @@ fn block_intrinsic_width() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_auto_bottom.rs b/tests/generated/block/block_margin_auto_bottom.rs index 46f74b760..9c6449ec4 100644 --- a/tests/generated/block/block_margin_auto_bottom.rs +++ b/tests/generated/block/block_margin_auto_bottom.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_auto_bottom() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -41,9 +41,9 @@ fn block_margin_auto_bottom() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/block/block_margin_auto_bottom_and_top.rs b/tests/generated/block/block_margin_auto_bottom_and_top.rs index e4ac7187a..5bb1bbf6b 100644 --- a/tests/generated/block/block_margin_auto_bottom_and_top.rs +++ b/tests/generated/block/block_margin_auto_bottom_and_top.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_auto_bottom_and_top() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -40,9 +40,9 @@ fn block_margin_auto_bottom_and_top() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/block/block_margin_auto_left.rs b/tests/generated/block/block_margin_auto_left.rs index 548baa611..4ef876bc8 100644 --- a/tests/generated/block/block_margin_auto_left.rs +++ b/tests/generated/block/block_margin_auto_left.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_auto_left() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -40,9 +40,9 @@ fn block_margin_auto_left() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/block/block_margin_auto_left_and_right.rs b/tests/generated/block/block_margin_auto_left_and_right.rs index f91749523..e4837e777 100644 --- a/tests/generated/block/block_margin_auto_left_and_right.rs +++ b/tests/generated/block/block_margin_auto_left_and_right.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_auto_left_and_right() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -40,9 +40,9 @@ fn block_margin_auto_left_and_right() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/block/block_margin_auto_left_child_bigger_than_parent.rs b/tests/generated/block/block_margin_auto_left_child_bigger_than_parent.rs index 254793a72..a28d8239e 100644 --- a/tests/generated/block/block_margin_auto_left_child_bigger_than_parent.rs +++ b/tests/generated/block/block_margin_auto_left_child_bigger_than_parent.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_auto_left_child_bigger_than_parent() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -31,9 +31,9 @@ fn block_margin_auto_left_child_bigger_than_parent() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 52f32, "width of node {:?}. Expected {}. Actual {}", node, 52f32, size.width); diff --git a/tests/generated/block/block_margin_auto_left_fix_right_child_bigger_than_parent.rs b/tests/generated/block/block_margin_auto_left_fix_right_child_bigger_than_parent.rs index 66088eae9..bfe4390cd 100644 --- a/tests/generated/block/block_margin_auto_left_fix_right_child_bigger_than_parent.rs +++ b/tests/generated/block/block_margin_auto_left_fix_right_child_bigger_than_parent.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_auto_left_fix_right_child_bigger_than_parent() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -31,9 +31,9 @@ fn block_margin_auto_left_fix_right_child_bigger_than_parent() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 52f32, "width of node {:?}. Expected {}. Actual {}", node, 52f32, size.width); diff --git a/tests/generated/block/block_margin_auto_left_right_child_bigger_than_parent.rs b/tests/generated/block/block_margin_auto_left_right_child_bigger_than_parent.rs index 406a15f3d..9623f4e49 100644 --- a/tests/generated/block/block_margin_auto_left_right_child_bigger_than_parent.rs +++ b/tests/generated/block/block_margin_auto_left_right_child_bigger_than_parent.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_auto_left_right_child_bigger_than_parent() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -31,9 +31,9 @@ fn block_margin_auto_left_right_child_bigger_than_parent() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 52f32, "width of node {:?}. Expected {}. Actual {}", node, 52f32, size.width); diff --git a/tests/generated/block/block_margin_auto_mutiple_children.rs b/tests/generated/block/block_margin_auto_mutiple_children.rs index 220be5332..e3613f08d 100644 --- a/tests/generated/block/block_margin_auto_mutiple_children.rs +++ b/tests/generated/block/block_margin_auto_mutiple_children.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_auto_mutiple_children() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -56,9 +56,9 @@ fn block_margin_auto_mutiple_children() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/block/block_margin_auto_right.rs b/tests/generated/block/block_margin_auto_right.rs index ba8c8eb2c..1f6cdf409 100644 --- a/tests/generated/block/block_margin_auto_right.rs +++ b/tests/generated/block/block_margin_auto_right.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_auto_right() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -41,9 +41,9 @@ fn block_margin_auto_right() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/block/block_margin_auto_top.rs b/tests/generated/block/block_margin_auto_top.rs index 4fc171b41..9aaf49fd3 100644 --- a/tests/generated/block/block_margin_auto_top.rs +++ b/tests/generated/block/block_margin_auto_top.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_auto_top() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -41,9 +41,9 @@ fn block_margin_auto_top() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/block/block_margin_x_fixed_auto_bottom.rs b/tests/generated/block/block_margin_x_fixed_auto_bottom.rs index b64ad82c1..6374f356f 100644 --- a/tests/generated/block/block_margin_x_fixed_auto_bottom.rs +++ b/tests/generated/block/block_margin_x_fixed_auto_bottom.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_x_fixed_auto_bottom() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -34,9 +34,9 @@ fn block_margin_x_fixed_auto_bottom() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_x_fixed_auto_left.rs b/tests/generated/block/block_margin_x_fixed_auto_left.rs index 43e7408d3..9fcd4a95f 100644 --- a/tests/generated/block/block_margin_x_fixed_auto_left.rs +++ b/tests/generated/block/block_margin_x_fixed_auto_left.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_x_fixed_auto_left() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -34,9 +34,9 @@ fn block_margin_x_fixed_auto_left() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_x_fixed_auto_left_and_right.rs b/tests/generated/block/block_margin_x_fixed_auto_left_and_right.rs index 04667c02f..bc3b37788 100644 --- a/tests/generated/block/block_margin_x_fixed_auto_left_and_right.rs +++ b/tests/generated/block/block_margin_x_fixed_auto_left_and_right.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_x_fixed_auto_left_and_right() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -34,9 +34,9 @@ fn block_margin_x_fixed_auto_left_and_right() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_x_fixed_auto_right.rs b/tests/generated/block/block_margin_x_fixed_auto_right.rs index f9681b9ee..7908f1b4f 100644 --- a/tests/generated/block/block_margin_x_fixed_auto_right.rs +++ b/tests/generated/block/block_margin_x_fixed_auto_right.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_x_fixed_auto_right() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -34,9 +34,9 @@ fn block_margin_x_fixed_auto_right() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_x_fixed_auto_top.rs b/tests/generated/block/block_margin_x_fixed_auto_top.rs index 2d44c4491..cf16a066d 100644 --- a/tests/generated/block/block_margin_x_fixed_auto_top.rs +++ b/tests/generated/block/block_margin_x_fixed_auto_top.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_x_fixed_auto_top() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -34,9 +34,9 @@ fn block_margin_x_fixed_auto_top() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_x_fixed_size_negative.rs b/tests/generated/block/block_margin_x_fixed_size_negative.rs index d56154fe8..2c87adf47 100644 --- a/tests/generated/block/block_margin_x_fixed_size_negative.rs +++ b/tests/generated/block/block_margin_x_fixed_size_negative.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_x_fixed_size_negative() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -31,9 +31,9 @@ fn block_margin_x_fixed_size_negative() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_x_fixed_size_positive.rs b/tests/generated/block/block_margin_x_fixed_size_positive.rs index 9d799484e..daba2a00a 100644 --- a/tests/generated/block/block_margin_x_fixed_size_positive.rs +++ b/tests/generated/block/block_margin_x_fixed_size_positive.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_x_fixed_size_positive() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -31,9 +31,9 @@ fn block_margin_x_fixed_size_positive() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_x_intrinsic_size_negative.rs b/tests/generated/block/block_margin_x_intrinsic_size_negative.rs index cb2f96dc2..6144c3eac 100644 --- a/tests/generated/block/block_margin_x_intrinsic_size_negative.rs +++ b/tests/generated/block/block_margin_x_intrinsic_size_negative.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_x_intrinsic_size_negative() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -27,9 +27,9 @@ fn block_margin_x_intrinsic_size_negative() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); diff --git a/tests/generated/block/block_margin_x_intrinsic_size_positive.rs b/tests/generated/block/block_margin_x_intrinsic_size_positive.rs index 455a72281..190fce52a 100644 --- a/tests/generated/block/block_margin_x_intrinsic_size_positive.rs +++ b/tests/generated/block/block_margin_x_intrinsic_size_positive.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_x_intrinsic_size_positive() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -27,9 +27,9 @@ fn block_margin_x_intrinsic_size_positive() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 15f32, "width of node {:?}. Expected {}. Actual {}", node, 15f32, size.width); diff --git a/tests/generated/block/block_margin_x_percentage_fixed_size_negative.rs b/tests/generated/block/block_margin_x_percentage_fixed_size_negative.rs index 3af4cf832..4f6448dc4 100644 --- a/tests/generated/block/block_margin_x_percentage_fixed_size_negative.rs +++ b/tests/generated/block/block_margin_x_percentage_fixed_size_negative.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_x_percentage_fixed_size_negative() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -31,9 +31,9 @@ fn block_margin_x_percentage_fixed_size_negative() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_x_percentage_fixed_size_positive.rs b/tests/generated/block/block_margin_x_percentage_fixed_size_positive.rs index d71f418f8..8c5ab54a9 100644 --- a/tests/generated/block/block_margin_x_percentage_fixed_size_positive.rs +++ b/tests/generated/block/block_margin_x_percentage_fixed_size_positive.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_x_percentage_fixed_size_positive() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -31,9 +31,9 @@ fn block_margin_x_percentage_fixed_size_positive() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_x_percentage_intrinsic_size_other_negative.rs b/tests/generated/block/block_margin_x_percentage_intrinsic_size_other_negative.rs index 263581ddc..69ab32324 100644 --- a/tests/generated/block/block_margin_x_percentage_intrinsic_size_other_negative.rs +++ b/tests/generated/block/block_margin_x_percentage_intrinsic_size_other_negative.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_x_percentage_intrinsic_size_other_negative() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -30,9 +30,9 @@ fn block_margin_x_percentage_intrinsic_size_other_negative() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/block/block_margin_x_percentage_intrinsic_size_other_positive.rs b/tests/generated/block/block_margin_x_percentage_intrinsic_size_other_positive.rs index 20b137562..5e139d2f3 100644 --- a/tests/generated/block/block_margin_x_percentage_intrinsic_size_other_positive.rs +++ b/tests/generated/block/block_margin_x_percentage_intrinsic_size_other_positive.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_x_percentage_intrinsic_size_other_positive() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -30,9 +30,9 @@ fn block_margin_x_percentage_intrinsic_size_other_positive() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/block/block_margin_x_percentage_intrinsic_size_self_negative.rs b/tests/generated/block/block_margin_x_percentage_intrinsic_size_self_negative.rs index 86701640e..cca05040d 100644 --- a/tests/generated/block/block_margin_x_percentage_intrinsic_size_self_negative.rs +++ b/tests/generated/block/block_margin_x_percentage_intrinsic_size_self_negative.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_x_percentage_intrinsic_size_self_negative() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -24,9 +24,9 @@ fn block_margin_x_percentage_intrinsic_size_self_negative() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/block/block_margin_x_percentage_intrinsic_size_self_positive.rs b/tests/generated/block/block_margin_x_percentage_intrinsic_size_self_positive.rs index eafa9a8d2..047b98cd4 100644 --- a/tests/generated/block/block_margin_x_percentage_intrinsic_size_self_positive.rs +++ b/tests/generated/block/block_margin_x_percentage_intrinsic_size_self_positive.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_x_percentage_intrinsic_size_self_positive() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -24,9 +24,9 @@ fn block_margin_x_percentage_intrinsic_size_self_positive() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/block/block_margin_y_collapse_complex.rs b/tests/generated/block/block_margin_y_collapse_complex.rs index 986b3225f..11f3e601c 100644 --- a/tests/generated/block/block_margin_y_collapse_complex.rs +++ b/tests/generated/block/block_margin_y_collapse_complex.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_collapse_complex() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -100,9 +100,9 @@ fn block_margin_y_collapse_complex() { &[node0, node1, node2, node3], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_collapse_through_blocked_by_aspect_ratio.rs b/tests/generated/block/block_margin_y_collapse_through_blocked_by_aspect_ratio.rs index 9b47999cf..fd588d407 100644 --- a/tests/generated/block/block_margin_y_collapse_through_blocked_by_aspect_ratio.rs +++ b/tests/generated/block/block_margin_y_collapse_through_blocked_by_aspect_ratio.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_collapse_through_blocked_by_aspect_ratio() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, @@ -52,9 +52,9 @@ fn block_margin_y_collapse_through_blocked_by_aspect_ratio() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_collapse_through_blocked_by_border_bottom.rs b/tests/generated/block/block_margin_y_collapse_through_blocked_by_border_bottom.rs index 10ed6d322..8282904a5 100644 --- a/tests/generated/block/block_margin_y_collapse_through_blocked_by_border_bottom.rs +++ b/tests/generated/block/block_margin_y_collapse_through_blocked_by_border_bottom.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_collapse_through_blocked_by_border_bottom() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, @@ -51,9 +51,9 @@ fn block_margin_y_collapse_through_blocked_by_border_bottom() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_collapse_through_blocked_by_border_top.rs b/tests/generated/block/block_margin_y_collapse_through_blocked_by_border_top.rs index 98874de61..4e056cdaf 100644 --- a/tests/generated/block/block_margin_y_collapse_through_blocked_by_border_top.rs +++ b/tests/generated/block/block_margin_y_collapse_through_blocked_by_border_top.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_collapse_through_blocked_by_border_top() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, @@ -51,9 +51,9 @@ fn block_margin_y_collapse_through_blocked_by_border_top() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_collapse_through_blocked_by_height.rs b/tests/generated/block/block_margin_y_collapse_through_blocked_by_height.rs index 0c1add949..ac3e112a5 100644 --- a/tests/generated/block/block_margin_y_collapse_through_blocked_by_height.rs +++ b/tests/generated/block/block_margin_y_collapse_through_blocked_by_height.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_collapse_through_blocked_by_height() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, @@ -52,9 +52,9 @@ fn block_margin_y_collapse_through_blocked_by_height() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_collapse_through_blocked_by_line_box.rs b/tests/generated/block/block_margin_y_collapse_through_blocked_by_line_box.rs index 244046036..bcaf4a78c 100644 --- a/tests/generated/block/block_margin_y_collapse_through_blocked_by_line_box.rs +++ b/tests/generated/block/block_margin_y_collapse_through_blocked_by_line_box.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_collapse_through_blocked_by_line_box() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, @@ -17,7 +17,7 @@ fn block_margin_y_collapse_through_blocked_by_line_box() { }) .unwrap(); let node1 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { display: taffy::style::Display::Block, margin: taffy::geometry::Rect { @@ -28,16 +28,11 @@ fn block_margin_y_collapse_through_blocked_by_line_box() { }, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node2 = taffy @@ -63,9 +58,9 @@ fn block_margin_y_collapse_through_blocked_by_line_box() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_collapse_through_blocked_by_line_box_with_height_zero.rs b/tests/generated/block/block_margin_y_collapse_through_blocked_by_line_box_with_height_zero.rs index b278f0d35..4d6512760 100644 --- a/tests/generated/block/block_margin_y_collapse_through_blocked_by_line_box_with_height_zero.rs +++ b/tests/generated/block/block_margin_y_collapse_through_blocked_by_line_box_with_height_zero.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_collapse_through_blocked_by_line_box_with_height_zero() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, @@ -17,7 +17,7 @@ fn block_margin_y_collapse_through_blocked_by_line_box_with_height_zero() { }) .unwrap(); let node1 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { display: taffy::style::Display::Block, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(0f32) }, @@ -29,16 +29,11 @@ fn block_margin_y_collapse_through_blocked_by_line_box_with_height_zero() { }, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node2 = taffy @@ -64,9 +59,9 @@ fn block_margin_y_collapse_through_blocked_by_line_box_with_height_zero() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_collapse_through_blocked_by_line_box_with_max_height_zero.rs b/tests/generated/block/block_margin_y_collapse_through_blocked_by_line_box_with_max_height_zero.rs index 467319339..451d9e888 100644 --- a/tests/generated/block/block_margin_y_collapse_through_blocked_by_line_box_with_max_height_zero.rs +++ b/tests/generated/block/block_margin_y_collapse_through_blocked_by_line_box_with_max_height_zero.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_collapse_through_blocked_by_line_box_with_max_height_zero() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, @@ -17,7 +17,7 @@ fn block_margin_y_collapse_through_blocked_by_line_box_with_max_height_zero() { }) .unwrap(); let node1 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { display: taffy::style::Display::Block, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(0f32) }, @@ -29,16 +29,11 @@ fn block_margin_y_collapse_through_blocked_by_line_box_with_max_height_zero() { }, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node2 = taffy @@ -64,9 +59,9 @@ fn block_margin_y_collapse_through_blocked_by_line_box_with_max_height_zero() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_collapse_through_blocked_by_min_height.rs b/tests/generated/block/block_margin_y_collapse_through_blocked_by_min_height.rs index 1bdd45d45..cb98b1589 100644 --- a/tests/generated/block/block_margin_y_collapse_through_blocked_by_min_height.rs +++ b/tests/generated/block/block_margin_y_collapse_through_blocked_by_min_height.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_collapse_through_blocked_by_min_height() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, @@ -52,9 +52,9 @@ fn block_margin_y_collapse_through_blocked_by_min_height() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_collapse_through_blocked_by_overflow_x_hidden.rs b/tests/generated/block/block_margin_y_collapse_through_blocked_by_overflow_x_hidden.rs index 34fcecdc1..9e0ffb293 100644 --- a/tests/generated/block/block_margin_y_collapse_through_blocked_by_overflow_x_hidden.rs +++ b/tests/generated/block/block_margin_y_collapse_through_blocked_by_overflow_x_hidden.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_collapse_through_blocked_by_overflow_x_hidden() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, @@ -53,9 +53,9 @@ fn block_margin_y_collapse_through_blocked_by_overflow_x_hidden() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_collapse_through_blocked_by_overflow_x_scroll.rs b/tests/generated/block/block_margin_y_collapse_through_blocked_by_overflow_x_scroll.rs index d97f37305..20a6e6173 100644 --- a/tests/generated/block/block_margin_y_collapse_through_blocked_by_overflow_x_scroll.rs +++ b/tests/generated/block/block_margin_y_collapse_through_blocked_by_overflow_x_scroll.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_collapse_through_blocked_by_overflow_x_scroll() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, @@ -53,9 +53,9 @@ fn block_margin_y_collapse_through_blocked_by_overflow_x_scroll() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_collapse_through_blocked_by_overflow_y_hidden.rs b/tests/generated/block/block_margin_y_collapse_through_blocked_by_overflow_y_hidden.rs index 8322d7ede..01879e8b1 100644 --- a/tests/generated/block/block_margin_y_collapse_through_blocked_by_overflow_y_hidden.rs +++ b/tests/generated/block/block_margin_y_collapse_through_blocked_by_overflow_y_hidden.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_collapse_through_blocked_by_overflow_y_hidden() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, @@ -53,9 +53,9 @@ fn block_margin_y_collapse_through_blocked_by_overflow_y_hidden() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_collapse_through_blocked_by_overflow_y_scroll.rs b/tests/generated/block/block_margin_y_collapse_through_blocked_by_overflow_y_scroll.rs index 1d88f18f2..c84ab1653 100644 --- a/tests/generated/block/block_margin_y_collapse_through_blocked_by_overflow_y_scroll.rs +++ b/tests/generated/block/block_margin_y_collapse_through_blocked_by_overflow_y_scroll.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_collapse_through_blocked_by_overflow_y_scroll() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, @@ -53,9 +53,9 @@ fn block_margin_y_collapse_through_blocked_by_overflow_y_scroll() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_collapse_through_blocked_by_padding_bottom.rs b/tests/generated/block/block_margin_y_collapse_through_blocked_by_padding_bottom.rs index a35d9c8a3..51168c2cc 100644 --- a/tests/generated/block/block_margin_y_collapse_through_blocked_by_padding_bottom.rs +++ b/tests/generated/block/block_margin_y_collapse_through_blocked_by_padding_bottom.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_collapse_through_blocked_by_padding_bottom() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, @@ -57,9 +57,9 @@ fn block_margin_y_collapse_through_blocked_by_padding_bottom() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_collapse_through_blocked_by_padding_top.rs b/tests/generated/block/block_margin_y_collapse_through_blocked_by_padding_top.rs index 1dee2ba3a..38059a367 100644 --- a/tests/generated/block/block_margin_y_collapse_through_blocked_by_padding_top.rs +++ b/tests/generated/block/block_margin_y_collapse_through_blocked_by_padding_top.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_collapse_through_blocked_by_padding_top() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, @@ -57,9 +57,9 @@ fn block_margin_y_collapse_through_blocked_by_padding_top() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_collapse_through_negative.rs b/tests/generated/block/block_margin_y_collapse_through_negative.rs index 2ae637c11..515cc6fac 100644 --- a/tests/generated/block/block_margin_y_collapse_through_negative.rs +++ b/tests/generated/block/block_margin_y_collapse_through_negative.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_collapse_through_negative() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, @@ -51,9 +51,9 @@ fn block_margin_y_collapse_through_negative() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_collapse_through_positive.rs b/tests/generated/block/block_margin_y_collapse_through_positive.rs index 3b3456547..b4fdab375 100644 --- a/tests/generated/block/block_margin_y_collapse_through_positive.rs +++ b/tests/generated/block/block_margin_y_collapse_through_positive.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_collapse_through_positive() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, @@ -51,9 +51,9 @@ fn block_margin_y_collapse_through_positive() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_collapse_through_positive_and_negative.rs b/tests/generated/block/block_margin_y_collapse_through_positive_and_negative.rs index 8901443a3..022545982 100644 --- a/tests/generated/block/block_margin_y_collapse_through_positive_and_negative.rs +++ b/tests/generated/block/block_margin_y_collapse_through_positive_and_negative.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_collapse_through_positive_and_negative() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, @@ -51,9 +51,9 @@ fn block_margin_y_collapse_through_positive_and_negative() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_collapse_through_with_absolute_child.rs b/tests/generated/block/block_margin_y_collapse_through_with_absolute_child.rs index d107ea7a3..11bb21a74 100644 --- a/tests/generated/block/block_margin_y_collapse_through_with_absolute_child.rs +++ b/tests/generated/block/block_margin_y_collapse_through_with_absolute_child.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_collapse_through_with_absolute_child() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, @@ -17,18 +17,13 @@ fn block_margin_y_collapse_through_with_absolute_child() { }) .unwrap(); let node10 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { position: taffy::style::Position::Absolute, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node1 = taffy @@ -69,9 +64,9 @@ fn block_margin_y_collapse_through_with_absolute_child() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_first_child_collapse_blocked_by_border_top.rs b/tests/generated/block/block_margin_y_first_child_collapse_blocked_by_border_top.rs index a7097d6ab..45cfbb3b7 100644 --- a/tests/generated/block/block_margin_y_first_child_collapse_blocked_by_border_top.rs +++ b/tests/generated/block/block_margin_y_first_child_collapse_blocked_by_border_top.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_first_child_collapse_blocked_by_border_top() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node000 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -49,9 +49,9 @@ fn block_margin_y_first_child_collapse_blocked_by_border_top() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_first_child_collapse_blocked_by_overflow_x_hidden.rs b/tests/generated/block/block_margin_y_first_child_collapse_blocked_by_overflow_x_hidden.rs index 7ed957a41..20cebe318 100644 --- a/tests/generated/block/block_margin_y_first_child_collapse_blocked_by_overflow_x_hidden.rs +++ b/tests/generated/block/block_margin_y_first_child_collapse_blocked_by_overflow_x_hidden.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_first_child_collapse_blocked_by_overflow_x_hidden() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node000 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -54,9 +54,9 @@ fn block_margin_y_first_child_collapse_blocked_by_overflow_x_hidden() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_first_child_collapse_blocked_by_overflow_x_scroll.rs b/tests/generated/block/block_margin_y_first_child_collapse_blocked_by_overflow_x_scroll.rs index eb3723f67..1422d32ba 100644 --- a/tests/generated/block/block_margin_y_first_child_collapse_blocked_by_overflow_x_scroll.rs +++ b/tests/generated/block/block_margin_y_first_child_collapse_blocked_by_overflow_x_scroll.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_first_child_collapse_blocked_by_overflow_x_scroll() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node000 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -54,9 +54,9 @@ fn block_margin_y_first_child_collapse_blocked_by_overflow_x_scroll() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_first_child_collapse_blocked_by_overflow_y_hidden.rs b/tests/generated/block/block_margin_y_first_child_collapse_blocked_by_overflow_y_hidden.rs index 7fe643d2a..e9821a264 100644 --- a/tests/generated/block/block_margin_y_first_child_collapse_blocked_by_overflow_y_hidden.rs +++ b/tests/generated/block/block_margin_y_first_child_collapse_blocked_by_overflow_y_hidden.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_first_child_collapse_blocked_by_overflow_y_hidden() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node000 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -54,9 +54,9 @@ fn block_margin_y_first_child_collapse_blocked_by_overflow_y_hidden() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_first_child_collapse_blocked_by_overflow_y_scroll.rs b/tests/generated/block/block_margin_y_first_child_collapse_blocked_by_overflow_y_scroll.rs index bcb497268..f49f0c9f4 100644 --- a/tests/generated/block/block_margin_y_first_child_collapse_blocked_by_overflow_y_scroll.rs +++ b/tests/generated/block/block_margin_y_first_child_collapse_blocked_by_overflow_y_scroll.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_first_child_collapse_blocked_by_overflow_y_scroll() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node000 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -54,9 +54,9 @@ fn block_margin_y_first_child_collapse_blocked_by_overflow_y_scroll() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_first_child_collapse_blocked_by_padding_top.rs b/tests/generated/block/block_margin_y_first_child_collapse_blocked_by_padding_top.rs index 85b06ac0f..e59f2154e 100644 --- a/tests/generated/block/block_margin_y_first_child_collapse_blocked_by_padding_top.rs +++ b/tests/generated/block/block_margin_y_first_child_collapse_blocked_by_padding_top.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_first_child_collapse_blocked_by_padding_top() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node000 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -55,9 +55,9 @@ fn block_margin_y_first_child_collapse_blocked_by_padding_top() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_first_child_collapse_negative_equal.rs b/tests/generated/block/block_margin_y_first_child_collapse_negative_equal.rs index 741586814..84cce09c0 100644 --- a/tests/generated/block/block_margin_y_first_child_collapse_negative_equal.rs +++ b/tests/generated/block/block_margin_y_first_child_collapse_negative_equal.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_first_child_collapse_negative_equal() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node000 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -49,9 +49,9 @@ fn block_margin_y_first_child_collapse_negative_equal() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_first_child_collapse_negative_parent_larger.rs b/tests/generated/block/block_margin_y_first_child_collapse_negative_parent_larger.rs index 0c73943be..4036c14d0 100644 --- a/tests/generated/block/block_margin_y_first_child_collapse_negative_parent_larger.rs +++ b/tests/generated/block/block_margin_y_first_child_collapse_negative_parent_larger.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_first_child_collapse_negative_parent_larger() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node000 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -49,9 +49,9 @@ fn block_margin_y_first_child_collapse_negative_parent_larger() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_first_child_collapse_negative_parent_smaller.rs b/tests/generated/block/block_margin_y_first_child_collapse_negative_parent_smaller.rs index 809d54a6e..34b5e82ad 100644 --- a/tests/generated/block/block_margin_y_first_child_collapse_negative_parent_smaller.rs +++ b/tests/generated/block/block_margin_y_first_child_collapse_negative_parent_smaller.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_first_child_collapse_negative_parent_smaller() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node000 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -49,9 +49,9 @@ fn block_margin_y_first_child_collapse_negative_parent_smaller() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_first_child_collapse_not_blocked_by_border_bottom.rs b/tests/generated/block/block_margin_y_first_child_collapse_not_blocked_by_border_bottom.rs index 2fff065fc..1dd383c33 100644 --- a/tests/generated/block/block_margin_y_first_child_collapse_not_blocked_by_border_bottom.rs +++ b/tests/generated/block/block_margin_y_first_child_collapse_not_blocked_by_border_bottom.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_first_child_collapse_not_blocked_by_border_bottom() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node000 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -49,9 +49,9 @@ fn block_margin_y_first_child_collapse_not_blocked_by_border_bottom() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_first_child_collapse_not_blocked_by_padding_bottom.rs b/tests/generated/block/block_margin_y_first_child_collapse_not_blocked_by_padding_bottom.rs index 14a9637cf..32b380aeb 100644 --- a/tests/generated/block/block_margin_y_first_child_collapse_not_blocked_by_padding_bottom.rs +++ b/tests/generated/block/block_margin_y_first_child_collapse_not_blocked_by_padding_bottom.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_first_child_collapse_not_blocked_by_padding_bottom() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node000 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -55,9 +55,9 @@ fn block_margin_y_first_child_collapse_not_blocked_by_padding_bottom() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_first_child_collapse_positive_and_negative.rs b/tests/generated/block/block_margin_y_first_child_collapse_positive_and_negative.rs index 52a1533e5..ff8c77b8f 100644 --- a/tests/generated/block/block_margin_y_first_child_collapse_positive_and_negative.rs +++ b/tests/generated/block/block_margin_y_first_child_collapse_positive_and_negative.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_first_child_collapse_positive_and_negative() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node000 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -121,9 +121,9 @@ fn block_margin_y_first_child_collapse_positive_and_negative() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_first_child_collapse_positive_equal.rs b/tests/generated/block/block_margin_y_first_child_collapse_positive_equal.rs index 017c1321e..1d458d914 100644 --- a/tests/generated/block/block_margin_y_first_child_collapse_positive_equal.rs +++ b/tests/generated/block/block_margin_y_first_child_collapse_positive_equal.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_first_child_collapse_positive_equal() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node000 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -49,9 +49,9 @@ fn block_margin_y_first_child_collapse_positive_equal() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_first_child_collapse_positive_parent_larger.rs b/tests/generated/block/block_margin_y_first_child_collapse_positive_parent_larger.rs index fd3e54043..6970a4a0f 100644 --- a/tests/generated/block/block_margin_y_first_child_collapse_positive_parent_larger.rs +++ b/tests/generated/block/block_margin_y_first_child_collapse_positive_parent_larger.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_first_child_collapse_positive_parent_larger() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node000 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -49,9 +49,9 @@ fn block_margin_y_first_child_collapse_positive_parent_larger() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_first_child_collapse_positive_parent_smaller.rs b/tests/generated/block/block_margin_y_first_child_collapse_positive_parent_smaller.rs index 1bee2fcdb..175e23ead 100644 --- a/tests/generated/block/block_margin_y_first_child_collapse_positive_parent_smaller.rs +++ b/tests/generated/block/block_margin_y_first_child_collapse_positive_parent_smaller.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_first_child_collapse_positive_parent_smaller() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node000 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -49,9 +49,9 @@ fn block_margin_y_first_child_collapse_positive_parent_smaller() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_first_granchild_collapse_positive_and_negative.rs b/tests/generated/block/block_margin_y_first_granchild_collapse_positive_and_negative.rs index 6df3cebd7..64dfd271d 100644 --- a/tests/generated/block/block_margin_y_first_granchild_collapse_positive_and_negative.rs +++ b/tests/generated/block/block_margin_y_first_granchild_collapse_positive_and_negative.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_first_granchild_collapse_positive_and_negative() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0000 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -166,9 +166,9 @@ fn block_margin_y_first_granchild_collapse_positive_and_negative() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_first_granchild_collapse_positive_equal.rs b/tests/generated/block/block_margin_y_first_granchild_collapse_positive_equal.rs index 1955a45db..e1e5735be 100644 --- a/tests/generated/block/block_margin_y_first_granchild_collapse_positive_equal.rs +++ b/tests/generated/block/block_margin_y_first_granchild_collapse_positive_equal.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_first_granchild_collapse_positive_equal() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0000 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -64,9 +64,9 @@ fn block_margin_y_first_granchild_collapse_positive_equal() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_last_child_collapse_blocked_by_border_bottom.rs b/tests/generated/block/block_margin_y_last_child_collapse_blocked_by_border_bottom.rs index 2a6c51adb..9f2c332ef 100644 --- a/tests/generated/block/block_margin_y_last_child_collapse_blocked_by_border_bottom.rs +++ b/tests/generated/block/block_margin_y_last_child_collapse_blocked_by_border_bottom.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_last_child_collapse_blocked_by_border_bottom() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node000 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -49,9 +49,9 @@ fn block_margin_y_last_child_collapse_blocked_by_border_bottom() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_last_child_collapse_blocked_by_overflow_x_hidden.rs b/tests/generated/block/block_margin_y_last_child_collapse_blocked_by_overflow_x_hidden.rs index 188f440d7..99a35e50a 100644 --- a/tests/generated/block/block_margin_y_last_child_collapse_blocked_by_overflow_x_hidden.rs +++ b/tests/generated/block/block_margin_y_last_child_collapse_blocked_by_overflow_x_hidden.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_last_child_collapse_blocked_by_overflow_x_hidden() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node000 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -54,9 +54,9 @@ fn block_margin_y_last_child_collapse_blocked_by_overflow_x_hidden() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_last_child_collapse_blocked_by_overflow_x_scroll.rs b/tests/generated/block/block_margin_y_last_child_collapse_blocked_by_overflow_x_scroll.rs index 1c737096c..31f36af8a 100644 --- a/tests/generated/block/block_margin_y_last_child_collapse_blocked_by_overflow_x_scroll.rs +++ b/tests/generated/block/block_margin_y_last_child_collapse_blocked_by_overflow_x_scroll.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_last_child_collapse_blocked_by_overflow_x_scroll() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node000 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -54,9 +54,9 @@ fn block_margin_y_last_child_collapse_blocked_by_overflow_x_scroll() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_last_child_collapse_blocked_by_overflow_y_hidden.rs b/tests/generated/block/block_margin_y_last_child_collapse_blocked_by_overflow_y_hidden.rs index 0e9cc3a2b..4c6f36d4b 100644 --- a/tests/generated/block/block_margin_y_last_child_collapse_blocked_by_overflow_y_hidden.rs +++ b/tests/generated/block/block_margin_y_last_child_collapse_blocked_by_overflow_y_hidden.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_last_child_collapse_blocked_by_overflow_y_hidden() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node000 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -54,9 +54,9 @@ fn block_margin_y_last_child_collapse_blocked_by_overflow_y_hidden() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_last_child_collapse_blocked_by_overflow_y_scroll.rs b/tests/generated/block/block_margin_y_last_child_collapse_blocked_by_overflow_y_scroll.rs index 96876abe0..bbf77c3f9 100644 --- a/tests/generated/block/block_margin_y_last_child_collapse_blocked_by_overflow_y_scroll.rs +++ b/tests/generated/block/block_margin_y_last_child_collapse_blocked_by_overflow_y_scroll.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_last_child_collapse_blocked_by_overflow_y_scroll() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node000 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -54,9 +54,9 @@ fn block_margin_y_last_child_collapse_blocked_by_overflow_y_scroll() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_last_child_collapse_blocked_by_padding_bottom.rs b/tests/generated/block/block_margin_y_last_child_collapse_blocked_by_padding_bottom.rs index 2ebecb3c9..c6c908305 100644 --- a/tests/generated/block/block_margin_y_last_child_collapse_blocked_by_padding_bottom.rs +++ b/tests/generated/block/block_margin_y_last_child_collapse_blocked_by_padding_bottom.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_last_child_collapse_blocked_by_padding_bottom() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node000 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -55,9 +55,9 @@ fn block_margin_y_last_child_collapse_blocked_by_padding_bottom() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_last_child_collapse_negative_equal.rs b/tests/generated/block/block_margin_y_last_child_collapse_negative_equal.rs index d4f673632..4c5ce1976 100644 --- a/tests/generated/block/block_margin_y_last_child_collapse_negative_equal.rs +++ b/tests/generated/block/block_margin_y_last_child_collapse_negative_equal.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_last_child_collapse_negative_equal() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node000 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -49,9 +49,9 @@ fn block_margin_y_last_child_collapse_negative_equal() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_last_child_collapse_negative_parent_larger.rs b/tests/generated/block/block_margin_y_last_child_collapse_negative_parent_larger.rs index 414b1eef2..49615031d 100644 --- a/tests/generated/block/block_margin_y_last_child_collapse_negative_parent_larger.rs +++ b/tests/generated/block/block_margin_y_last_child_collapse_negative_parent_larger.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_last_child_collapse_negative_parent_larger() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node000 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -49,9 +49,9 @@ fn block_margin_y_last_child_collapse_negative_parent_larger() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_last_child_collapse_negative_parent_smaller.rs b/tests/generated/block/block_margin_y_last_child_collapse_negative_parent_smaller.rs index fa925d5a7..5bce5da0b 100644 --- a/tests/generated/block/block_margin_y_last_child_collapse_negative_parent_smaller.rs +++ b/tests/generated/block/block_margin_y_last_child_collapse_negative_parent_smaller.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_last_child_collapse_negative_parent_smaller() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node000 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -49,9 +49,9 @@ fn block_margin_y_last_child_collapse_negative_parent_smaller() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_last_child_collapse_not_blocked_by_border_top.rs b/tests/generated/block/block_margin_y_last_child_collapse_not_blocked_by_border_top.rs index 3c32de12e..a001c6827 100644 --- a/tests/generated/block/block_margin_y_last_child_collapse_not_blocked_by_border_top.rs +++ b/tests/generated/block/block_margin_y_last_child_collapse_not_blocked_by_border_top.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_last_child_collapse_not_blocked_by_border_top() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node000 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -49,9 +49,9 @@ fn block_margin_y_last_child_collapse_not_blocked_by_border_top() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_last_child_collapse_not_blocked_by_padding_top.rs b/tests/generated/block/block_margin_y_last_child_collapse_not_blocked_by_padding_top.rs index 7144d4d48..978c11835 100644 --- a/tests/generated/block/block_margin_y_last_child_collapse_not_blocked_by_padding_top.rs +++ b/tests/generated/block/block_margin_y_last_child_collapse_not_blocked_by_padding_top.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_last_child_collapse_not_blocked_by_padding_top() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node000 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -55,9 +55,9 @@ fn block_margin_y_last_child_collapse_not_blocked_by_padding_top() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_last_child_collapse_positive_and_negative.rs b/tests/generated/block/block_margin_y_last_child_collapse_positive_and_negative.rs index 1a7ad113f..e5468011a 100644 --- a/tests/generated/block/block_margin_y_last_child_collapse_positive_and_negative.rs +++ b/tests/generated/block/block_margin_y_last_child_collapse_positive_and_negative.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_last_child_collapse_positive_and_negative() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node000 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -121,9 +121,9 @@ fn block_margin_y_last_child_collapse_positive_and_negative() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_last_child_collapse_positive_equal.rs b/tests/generated/block/block_margin_y_last_child_collapse_positive_equal.rs index 75a27413d..418d1d6bb 100644 --- a/tests/generated/block/block_margin_y_last_child_collapse_positive_equal.rs +++ b/tests/generated/block/block_margin_y_last_child_collapse_positive_equal.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_last_child_collapse_positive_equal() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node000 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -49,9 +49,9 @@ fn block_margin_y_last_child_collapse_positive_equal() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_last_child_collapse_positive_parent_larger.rs b/tests/generated/block/block_margin_y_last_child_collapse_positive_parent_larger.rs index a33c5b377..608f5f66b 100644 --- a/tests/generated/block/block_margin_y_last_child_collapse_positive_parent_larger.rs +++ b/tests/generated/block/block_margin_y_last_child_collapse_positive_parent_larger.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_last_child_collapse_positive_parent_larger() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node000 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -49,9 +49,9 @@ fn block_margin_y_last_child_collapse_positive_parent_larger() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_last_child_collapse_positive_parent_smaller.rs b/tests/generated/block/block_margin_y_last_child_collapse_positive_parent_smaller.rs index f01ec4f35..b38d7c182 100644 --- a/tests/generated/block/block_margin_y_last_child_collapse_positive_parent_smaller.rs +++ b/tests/generated/block/block_margin_y_last_child_collapse_positive_parent_smaller.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_last_child_collapse_positive_parent_smaller() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node000 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -49,9 +49,9 @@ fn block_margin_y_last_child_collapse_positive_parent_smaller() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_last_granchild_collapse_positive_equal.rs b/tests/generated/block/block_margin_y_last_granchild_collapse_positive_equal.rs index 21fa366df..d1531119e 100644 --- a/tests/generated/block/block_margin_y_last_granchild_collapse_positive_equal.rs +++ b/tests/generated/block/block_margin_y_last_granchild_collapse_positive_equal.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_last_granchild_collapse_positive_equal() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0000 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -64,9 +64,9 @@ fn block_margin_y_last_granchild_collapse_positive_equal() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_sibling_collapse_negative.rs b/tests/generated/block/block_margin_y_sibling_collapse_negative.rs index 5a957a688..28d174d11 100644 --- a/tests/generated/block/block_margin_y_sibling_collapse_negative.rs +++ b/tests/generated/block/block_margin_y_sibling_collapse_negative.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_sibling_collapse_negative() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -61,9 +61,9 @@ fn block_margin_y_sibling_collapse_negative() { &[node0, node1, node2, node3], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_sibling_collapse_negative_percentage.rs b/tests/generated/block/block_margin_y_sibling_collapse_negative_percentage.rs index 003bc7c3d..79fe0541b 100644 --- a/tests/generated/block/block_margin_y_sibling_collapse_negative_percentage.rs +++ b/tests/generated/block/block_margin_y_sibling_collapse_negative_percentage.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_sibling_collapse_negative_percentage() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -61,9 +61,9 @@ fn block_margin_y_sibling_collapse_negative_percentage() { &[node0, node1, node2, node3], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_sibling_collapse_positive.rs b/tests/generated/block/block_margin_y_sibling_collapse_positive.rs index 51ea38ace..42f8a3cfa 100644 --- a/tests/generated/block/block_margin_y_sibling_collapse_positive.rs +++ b/tests/generated/block/block_margin_y_sibling_collapse_positive.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_sibling_collapse_positive() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -61,9 +61,9 @@ fn block_margin_y_sibling_collapse_positive() { &[node0, node1, node2, node3], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_sibling_collapse_positive_and_negative.rs b/tests/generated/block/block_margin_y_sibling_collapse_positive_and_negative.rs index 683956ac4..edfd43eb7 100644 --- a/tests/generated/block/block_margin_y_sibling_collapse_positive_and_negative.rs +++ b/tests/generated/block/block_margin_y_sibling_collapse_positive_and_negative.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_sibling_collapse_positive_and_negative() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -97,9 +97,9 @@ fn block_margin_y_sibling_collapse_positive_and_negative() { &[node0, node1, node2, node3, node4, node5, node6], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_sibling_collapse_positive_and_negative_percentage.rs b/tests/generated/block/block_margin_y_sibling_collapse_positive_and_negative_percentage.rs index 7d60e8eef..587f73768 100644 --- a/tests/generated/block/block_margin_y_sibling_collapse_positive_and_negative_percentage.rs +++ b/tests/generated/block/block_margin_y_sibling_collapse_positive_and_negative_percentage.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_sibling_collapse_positive_and_negative_percentage() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -97,9 +97,9 @@ fn block_margin_y_sibling_collapse_positive_and_negative_percentage() { &[node0, node1, node2, node3, node4, node5, node6], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_sibling_collapse_positive_percentage.rs b/tests/generated/block/block_margin_y_sibling_collapse_positive_percentage.rs index 19efac9a5..563446793 100644 --- a/tests/generated/block/block_margin_y_sibling_collapse_positive_percentage.rs +++ b/tests/generated/block/block_margin_y_sibling_collapse_positive_percentage.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_sibling_collapse_positive_percentage() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -61,9 +61,9 @@ fn block_margin_y_sibling_collapse_positive_percentage() { &[node0, node1, node2, node3], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_simple_negative.rs b/tests/generated/block/block_margin_y_simple_negative.rs index 696cc3cef..cef27de7b 100644 --- a/tests/generated/block/block_margin_y_simple_negative.rs +++ b/tests/generated/block/block_margin_y_simple_negative.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_simple_negative() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -31,9 +31,9 @@ fn block_margin_y_simple_negative() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_simple_negative_percentage_other.rs b/tests/generated/block/block_margin_y_simple_negative_percentage_other.rs index 7f767e945..3b63fc074 100644 --- a/tests/generated/block/block_margin_y_simple_negative_percentage_other.rs +++ b/tests/generated/block/block_margin_y_simple_negative_percentage_other.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_simple_negative_percentage_other() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -34,9 +34,9 @@ fn block_margin_y_simple_negative_percentage_other() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_simple_negative_percentage_self.rs b/tests/generated/block/block_margin_y_simple_negative_percentage_self.rs index 5cb1a9dc9..005d87942 100644 --- a/tests/generated/block/block_margin_y_simple_negative_percentage_self.rs +++ b/tests/generated/block/block_margin_y_simple_negative_percentage_self.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_simple_negative_percentage_self() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -34,9 +34,9 @@ fn block_margin_y_simple_negative_percentage_self() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_simple_positive.rs b/tests/generated/block/block_margin_y_simple_positive.rs index 3c8f3eef3..554774f17 100644 --- a/tests/generated/block/block_margin_y_simple_positive.rs +++ b/tests/generated/block/block_margin_y_simple_positive.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_simple_positive() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -31,9 +31,9 @@ fn block_margin_y_simple_positive() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_simple_positive_percentage_other.rs b/tests/generated/block/block_margin_y_simple_positive_percentage_other.rs index 957c65aaf..05ba62d47 100644 --- a/tests/generated/block/block_margin_y_simple_positive_percentage_other.rs +++ b/tests/generated/block/block_margin_y_simple_positive_percentage_other.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_simple_positive_percentage_other() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -30,9 +30,9 @@ fn block_margin_y_simple_positive_percentage_other() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_simple_positive_percentage_self.rs b/tests/generated/block/block_margin_y_simple_positive_percentage_self.rs index 4a9481d95..47842c1d9 100644 --- a/tests/generated/block/block_margin_y_simple_positive_percentage_self.rs +++ b/tests/generated/block/block_margin_y_simple_positive_percentage_self.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_simple_positive_percentage_self() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -30,9 +30,9 @@ fn block_margin_y_simple_positive_percentage_self() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_total_collapse.rs b/tests/generated/block/block_margin_y_total_collapse.rs index 942b16fbe..0b8832ab3 100644 --- a/tests/generated/block/block_margin_y_total_collapse.rs +++ b/tests/generated/block/block_margin_y_total_collapse.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_total_collapse() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, @@ -67,9 +67,9 @@ fn block_margin_y_total_collapse() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_margin_y_total_collapse_complex.rs b/tests/generated/block/block_margin_y_total_collapse_complex.rs index f9cc49aa3..dffb754d0 100644 --- a/tests/generated/block/block_margin_y_total_collapse_complex.rs +++ b/tests/generated/block/block_margin_y_total_collapse_complex.rs @@ -1,8 +1,8 @@ #[test] fn block_margin_y_total_collapse_complex() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -100,9 +100,9 @@ fn block_margin_y_total_collapse_complex() { &[node0, node1, node2, node3], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_overflow_scrollbars_overriden_by_available_space.rs b/tests/generated/block/block_overflow_scrollbars_overriden_by_available_space.rs index 4595b4ba5..52eede9f5 100644 --- a/tests/generated/block/block_overflow_scrollbars_overriden_by_available_space.rs +++ b/tests/generated/block/block_overflow_scrollbars_overriden_by_available_space.rs @@ -1,8 +1,8 @@ #[test] fn block_overflow_scrollbars_overriden_by_available_space() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -42,9 +42,9 @@ fn block_overflow_scrollbars_overriden_by_available_space() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node, 2f32, size.width); diff --git a/tests/generated/block/block_overflow_scrollbars_overriden_by_max_size.rs b/tests/generated/block/block_overflow_scrollbars_overriden_by_max_size.rs index c08dc9de5..bbde937d8 100644 --- a/tests/generated/block/block_overflow_scrollbars_overriden_by_max_size.rs +++ b/tests/generated/block/block_overflow_scrollbars_overriden_by_max_size.rs @@ -1,8 +1,8 @@ #[test] fn block_overflow_scrollbars_overriden_by_max_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -33,9 +33,9 @@ fn block_overflow_scrollbars_overriden_by_max_size() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node, 2f32, size.width); diff --git a/tests/generated/block/block_overflow_scrollbars_overriden_by_size.rs b/tests/generated/block/block_overflow_scrollbars_overriden_by_size.rs index e53a02893..2ce98b9fb 100644 --- a/tests/generated/block/block_overflow_scrollbars_overriden_by_size.rs +++ b/tests/generated/block/block_overflow_scrollbars_overriden_by_size.rs @@ -1,8 +1,8 @@ #[test] fn block_overflow_scrollbars_overriden_by_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -33,9 +33,9 @@ fn block_overflow_scrollbars_overriden_by_size() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node, 2f32, size.width); diff --git a/tests/generated/block/block_overflow_scrollbars_take_up_space_both_axis.rs b/tests/generated/block/block_overflow_scrollbars_take_up_space_both_axis.rs index c89de6ce5..763d563e1 100644 --- a/tests/generated/block/block_overflow_scrollbars_take_up_space_both_axis.rs +++ b/tests/generated/block/block_overflow_scrollbars_take_up_space_both_axis.rs @@ -1,8 +1,8 @@ #[test] fn block_overflow_scrollbars_take_up_space_both_axis() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -33,9 +33,9 @@ fn block_overflow_scrollbars_take_up_space_both_axis() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_overflow_scrollbars_take_up_space_cross_axis.rs b/tests/generated/block/block_overflow_scrollbars_take_up_space_cross_axis.rs index d5e8b5457..6af346e90 100644 --- a/tests/generated/block/block_overflow_scrollbars_take_up_space_cross_axis.rs +++ b/tests/generated/block/block_overflow_scrollbars_take_up_space_cross_axis.rs @@ -1,8 +1,8 @@ #[test] fn block_overflow_scrollbars_take_up_space_cross_axis() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -33,9 +33,9 @@ fn block_overflow_scrollbars_take_up_space_cross_axis() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_overflow_scrollbars_take_up_space_main_axis.rs b/tests/generated/block/block_overflow_scrollbars_take_up_space_main_axis.rs index 769039bae..b28e31fdc 100644 --- a/tests/generated/block/block_overflow_scrollbars_take_up_space_main_axis.rs +++ b/tests/generated/block/block_overflow_scrollbars_take_up_space_main_axis.rs @@ -1,8 +1,8 @@ #[test] fn block_overflow_scrollbars_take_up_space_main_axis() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -33,9 +33,9 @@ fn block_overflow_scrollbars_take_up_space_main_axis() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_padding_border_fixed_size.rs b/tests/generated/block/block_padding_border_fixed_size.rs index 52293bf36..271c614a0 100644 --- a/tests/generated/block/block_padding_border_fixed_size.rs +++ b/tests/generated/block/block_padding_border_fixed_size.rs @@ -1,8 +1,8 @@ #[test] fn block_padding_border_fixed_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -40,9 +40,9 @@ fn block_padding_border_fixed_size() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_padding_border_intrinsic_size.rs b/tests/generated/block/block_padding_border_intrinsic_size.rs index ea7c87e67..e5f4eb98a 100644 --- a/tests/generated/block/block_padding_border_intrinsic_size.rs +++ b/tests/generated/block/block_padding_border_intrinsic_size.rs @@ -1,8 +1,8 @@ #[test] fn block_padding_border_intrinsic_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -39,9 +39,9 @@ fn block_padding_border_intrinsic_size() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 72f32, "width of node {:?}. Expected {}. Actual {}", node, 72f32, size.width); diff --git a/tests/generated/block/block_padding_border_overrides_max_size.rs b/tests/generated/block/block_padding_border_overrides_max_size.rs index 0aa729014..edc2ab6fd 100644 --- a/tests/generated/block/block_padding_border_overrides_max_size.rs +++ b/tests/generated/block/block_padding_border_overrides_max_size.rs @@ -1,8 +1,8 @@ #[test] fn block_padding_border_overrides_max_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node0 = taffy .new_with_children( @@ -35,9 +35,9 @@ fn block_padding_border_overrides_max_size() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node, 22f32, size.width); diff --git a/tests/generated/block/block_padding_border_overrides_min_size.rs b/tests/generated/block/block_padding_border_overrides_min_size.rs index fb05863c3..212502abe 100644 --- a/tests/generated/block/block_padding_border_overrides_min_size.rs +++ b/tests/generated/block/block_padding_border_overrides_min_size.rs @@ -1,8 +1,8 @@ #[test] fn block_padding_border_overrides_min_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node0 = taffy .new_with_children( @@ -35,9 +35,9 @@ fn block_padding_border_overrides_min_size() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node, 22f32, size.width); diff --git a/tests/generated/block/block_padding_border_overrides_size.rs b/tests/generated/block/block_padding_border_overrides_size.rs index 9db2835b6..2e3e09eab 100644 --- a/tests/generated/block/block_padding_border_overrides_size.rs +++ b/tests/generated/block/block_padding_border_overrides_size.rs @@ -1,8 +1,8 @@ #[test] fn block_padding_border_overrides_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node0 = taffy .new_with_children( @@ -35,9 +35,9 @@ fn block_padding_border_overrides_size() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node, 22f32, size.width); diff --git a/tests/generated/block/block_padding_border_percentage_fixed_size.rs b/tests/generated/block/block_padding_border_percentage_fixed_size.rs index a4db79572..71da370ba 100644 --- a/tests/generated/block/block_padding_border_percentage_fixed_size.rs +++ b/tests/generated/block/block_padding_border_percentage_fixed_size.rs @@ -1,8 +1,8 @@ #[test] fn block_padding_border_percentage_fixed_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, @@ -38,9 +38,9 @@ fn block_padding_border_percentage_fixed_size() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_padding_border_percentage_intrinsic_size.rs b/tests/generated/block/block_padding_border_percentage_intrinsic_size.rs index 7021835fa..4c20c5e1f 100644 --- a/tests/generated/block/block_padding_border_percentage_intrinsic_size.rs +++ b/tests/generated/block/block_padding_border_percentage_intrinsic_size.rs @@ -1,8 +1,8 @@ #[test] fn block_padding_border_percentage_intrinsic_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, @@ -31,9 +31,9 @@ fn block_padding_border_percentage_intrinsic_size() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); diff --git a/tests/generated/block/block_padding_fixed_size.rs b/tests/generated/block/block_padding_fixed_size.rs index 6c6bbfdfb..36504ed21 100644 --- a/tests/generated/block/block_padding_fixed_size.rs +++ b/tests/generated/block/block_padding_fixed_size.rs @@ -1,8 +1,8 @@ #[test] fn block_padding_fixed_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -34,9 +34,9 @@ fn block_padding_fixed_size() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_padding_intrinsic_size.rs b/tests/generated/block/block_padding_intrinsic_size.rs index 91e8fe420..7435462e3 100644 --- a/tests/generated/block/block_padding_intrinsic_size.rs +++ b/tests/generated/block/block_padding_intrinsic_size.rs @@ -1,8 +1,8 @@ #[test] fn block_padding_intrinsic_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -33,9 +33,9 @@ fn block_padding_intrinsic_size() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 62f32, "width of node {:?}. Expected {}. Actual {}", node, 62f32, size.width); diff --git a/tests/generated/block/block_padding_percentage_fixed_size.rs b/tests/generated/block/block_padding_percentage_fixed_size.rs index 05a523698..caa6bf5dc 100644 --- a/tests/generated/block/block_padding_percentage_fixed_size.rs +++ b/tests/generated/block/block_padding_percentage_fixed_size.rs @@ -1,8 +1,8 @@ #[test] fn block_padding_percentage_fixed_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, @@ -38,9 +38,9 @@ fn block_padding_percentage_fixed_size() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/block/block_padding_percentage_intrinsic_size.rs b/tests/generated/block/block_padding_percentage_intrinsic_size.rs index 2b0ed8bda..49e1e99d3 100644 --- a/tests/generated/block/block_padding_percentage_intrinsic_size.rs +++ b/tests/generated/block/block_padding_percentage_intrinsic_size.rs @@ -1,8 +1,8 @@ #[test] fn block_padding_percentage_intrinsic_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, @@ -31,9 +31,9 @@ fn block_padding_percentage_intrinsic_size() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); diff --git a/tests/generated/blockflex/blockflex_block_in_flex_column.rs b/tests/generated/blockflex/blockflex_block_in_flex_column.rs index 4a1df8fed..985fc75fa 100644 --- a/tests/generated/blockflex/blockflex_block_in_flex_column.rs +++ b/tests/generated/blockflex/blockflex_block_in_flex_column.rs @@ -1,8 +1,8 @@ #[test] fn blockflex_block_in_flex_column() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }).unwrap(); let node1 = taffy @@ -26,9 +26,9 @@ fn blockflex_block_in_flex_column() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/blockflex/blockflex_block_in_flex_row.rs b/tests/generated/blockflex/blockflex_block_in_flex_row.rs index 328ec065e..22f345246 100644 --- a/tests/generated/blockflex/blockflex_block_in_flex_row.rs +++ b/tests/generated/blockflex/blockflex_block_in_flex_row.rs @@ -1,8 +1,8 @@ #[test] fn blockflex_block_in_flex_row() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }).unwrap(); let node1 = taffy @@ -25,9 +25,9 @@ fn blockflex_block_in_flex_row() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/blockflex/blockflex_flex_in_block.rs b/tests/generated/blockflex/blockflex_flex_in_block.rs index bc05c0f55..d2dae0e8f 100644 --- a/tests/generated/blockflex/blockflex_flex_in_block.rs +++ b/tests/generated/blockflex/blockflex_flex_in_block.rs @@ -1,8 +1,8 @@ #[test] fn blockflex_flex_in_block() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -38,9 +38,9 @@ fn blockflex_flex_in_block() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/blockflex/blockflex_margin_y_collapse_through_blocked_by_flex.rs b/tests/generated/blockflex/blockflex_margin_y_collapse_through_blocked_by_flex.rs index f0ba3ab01..9b32c55fd 100644 --- a/tests/generated/blockflex/blockflex_margin_y_collapse_through_blocked_by_flex.rs +++ b/tests/generated/blockflex/blockflex_margin_y_collapse_through_blocked_by_flex.rs @@ -1,8 +1,8 @@ #[test] fn blockflex_margin_y_collapse_through_blocked_by_flex() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, @@ -51,9 +51,9 @@ fn blockflex_margin_y_collapse_through_blocked_by_flex() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/blockflex/blockflex_margin_y_first_child_collapse_blocked_by_flex.rs b/tests/generated/blockflex/blockflex_margin_y_first_child_collapse_blocked_by_flex.rs index 68fb71002..c2f276f80 100644 --- a/tests/generated/blockflex/blockflex_margin_y_first_child_collapse_blocked_by_flex.rs +++ b/tests/generated/blockflex/blockflex_margin_y_first_child_collapse_blocked_by_flex.rs @@ -1,8 +1,8 @@ #[test] fn blockflex_margin_y_first_child_collapse_blocked_by_flex() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node000 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -49,9 +49,9 @@ fn blockflex_margin_y_first_child_collapse_blocked_by_flex() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/blockflex/blockflex_margin_y_last_child_collapse_blocked_by_flex.rs b/tests/generated/blockflex/blockflex_margin_y_last_child_collapse_blocked_by_flex.rs index 39bf73082..86d4acae5 100644 --- a/tests/generated/blockflex/blockflex_margin_y_last_child_collapse_blocked_by_flex.rs +++ b/tests/generated/blockflex/blockflex_margin_y_last_child_collapse_blocked_by_flex.rs @@ -1,8 +1,8 @@ #[test] fn blockflex_margin_y_last_child_collapse_blocked_by_flex() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node000 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -49,9 +49,9 @@ fn blockflex_margin_y_last_child_collapse_blocked_by_flex() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/blockflex/blockflex_overflow_hidden.rs b/tests/generated/blockflex/blockflex_overflow_hidden.rs index 7c88ca2b8..94b75dc2c 100644 --- a/tests/generated/blockflex/blockflex_overflow_hidden.rs +++ b/tests/generated/blockflex/blockflex_overflow_hidden.rs @@ -1,10 +1,10 @@ #[test] fn blockflex_overflow_hidden() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { display: taffy::style::Display::Block, overflow: taffy::geometry::Point { @@ -15,31 +15,21 @@ fn blockflex_overflow_hidden() { flex_grow: 1f32, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HHHH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HHHH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node1 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { display: taffy::style::Display::Block, flex_grow: 1f32, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HHHH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HHHH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -55,9 +45,9 @@ fn blockflex_overflow_hidden() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); diff --git a/tests/generated/blockgrid/blockgrid_block_in_grid_auto.rs b/tests/generated/blockgrid/blockgrid_block_in_grid_auto.rs index 10ba54818..e79660ca7 100644 --- a/tests/generated/blockgrid/blockgrid_block_in_grid_auto.rs +++ b/tests/generated/blockgrid/blockgrid_block_in_grid_auto.rs @@ -1,21 +1,16 @@ #[test] fn blockgrid_block_in_grid_auto() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node1 = @@ -30,9 +25,9 @@ fn blockgrid_block_in_grid_auto() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); diff --git a/tests/generated/blockgrid/blockgrid_block_in_grid_fixed_fit_content_larger.rs b/tests/generated/blockgrid/blockgrid_block_in_grid_fixed_fit_content_larger.rs index c8e184d7c..2ccf93010 100644 --- a/tests/generated/blockgrid/blockgrid_block_in_grid_fixed_fit_content_larger.rs +++ b/tests/generated/blockgrid/blockgrid_block_in_grid_fixed_fit_content_larger.rs @@ -1,21 +1,16 @@ #[test] fn blockgrid_block_in_grid_fixed_fit_content_larger() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node1 = @@ -30,9 +25,9 @@ fn blockgrid_block_in_grid_fixed_fit_content_larger() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); diff --git a/tests/generated/blockgrid/blockgrid_block_in_grid_fixed_fit_content_middle.rs b/tests/generated/blockgrid/blockgrid_block_in_grid_fixed_fit_content_middle.rs index bb7a38a98..f490fbd6e 100644 --- a/tests/generated/blockgrid/blockgrid_block_in_grid_fixed_fit_content_middle.rs +++ b/tests/generated/blockgrid/blockgrid_block_in_grid_fixed_fit_content_middle.rs @@ -1,21 +1,16 @@ #[test] fn blockgrid_block_in_grid_fixed_fit_content_middle() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node1 = @@ -30,9 +25,9 @@ fn blockgrid_block_in_grid_fixed_fit_content_middle() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node, 30f32, size.width); diff --git a/tests/generated/blockgrid/blockgrid_block_in_grid_fixed_fit_content_smaller.rs b/tests/generated/blockgrid/blockgrid_block_in_grid_fixed_fit_content_smaller.rs index a174fed05..2c76c2dde 100644 --- a/tests/generated/blockgrid/blockgrid_block_in_grid_fixed_fit_content_smaller.rs +++ b/tests/generated/blockgrid/blockgrid_block_in_grid_fixed_fit_content_smaller.rs @@ -1,21 +1,16 @@ #[test] fn blockgrid_block_in_grid_fixed_fit_content_smaller() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node1 = @@ -30,9 +25,9 @@ fn blockgrid_block_in_grid_fixed_fit_content_smaller() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); diff --git a/tests/generated/blockgrid/blockgrid_block_in_grid_fixed_larger.rs b/tests/generated/blockgrid/blockgrid_block_in_grid_fixed_larger.rs index b98a24866..715945e34 100644 --- a/tests/generated/blockgrid/blockgrid_block_in_grid_fixed_larger.rs +++ b/tests/generated/blockgrid/blockgrid_block_in_grid_fixed_larger.rs @@ -1,21 +1,16 @@ #[test] fn blockgrid_block_in_grid_fixed_larger() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node1 = @@ -30,9 +25,9 @@ fn blockgrid_block_in_grid_fixed_larger() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/blockgrid/blockgrid_block_in_grid_fixed_middle.rs b/tests/generated/blockgrid/blockgrid_block_in_grid_fixed_middle.rs index 714ac6ad3..63c1521c1 100644 --- a/tests/generated/blockgrid/blockgrid_block_in_grid_fixed_middle.rs +++ b/tests/generated/blockgrid/blockgrid_block_in_grid_fixed_middle.rs @@ -1,21 +1,16 @@ #[test] fn blockgrid_block_in_grid_fixed_middle() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node1 = @@ -30,9 +25,9 @@ fn blockgrid_block_in_grid_fixed_middle() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node, 30f32, size.width); diff --git a/tests/generated/blockgrid/blockgrid_block_in_grid_fixed_smaller.rs b/tests/generated/blockgrid/blockgrid_block_in_grid_fixed_smaller.rs index 242ea5366..5aea5687a 100644 --- a/tests/generated/blockgrid/blockgrid_block_in_grid_fixed_smaller.rs +++ b/tests/generated/blockgrid/blockgrid_block_in_grid_fixed_smaller.rs @@ -1,21 +1,16 @@ #[test] fn blockgrid_block_in_grid_fixed_smaller() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node1 = @@ -30,9 +25,9 @@ fn blockgrid_block_in_grid_fixed_smaller() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node, 10f32, size.width); diff --git a/tests/generated/blockgrid/blockgrid_block_in_grid_fr.rs b/tests/generated/blockgrid/blockgrid_block_in_grid_fr.rs index 5c60cec24..2253faa09 100644 --- a/tests/generated/blockgrid/blockgrid_block_in_grid_fr.rs +++ b/tests/generated/blockgrid/blockgrid_block_in_grid_fr.rs @@ -1,21 +1,16 @@ #[test] fn blockgrid_block_in_grid_fr() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node1 = @@ -30,9 +25,9 @@ fn blockgrid_block_in_grid_fr() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); diff --git a/tests/generated/blockgrid/blockgrid_block_in_grid_max_content.rs b/tests/generated/blockgrid/blockgrid_block_in_grid_max_content.rs index 9e035bc3f..59a9f3e75 100644 --- a/tests/generated/blockgrid/blockgrid_block_in_grid_max_content.rs +++ b/tests/generated/blockgrid/blockgrid_block_in_grid_max_content.rs @@ -1,21 +1,16 @@ #[test] fn blockgrid_block_in_grid_max_content() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node1 = @@ -30,9 +25,9 @@ fn blockgrid_block_in_grid_max_content() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); diff --git a/tests/generated/blockgrid/blockgrid_block_in_grid_min_content.rs b/tests/generated/blockgrid/blockgrid_block_in_grid_min_content.rs index 3bba9053d..374e5d052 100644 --- a/tests/generated/blockgrid/blockgrid_block_in_grid_min_content.rs +++ b/tests/generated/blockgrid/blockgrid_block_in_grid_min_content.rs @@ -1,21 +1,16 @@ #[test] fn blockgrid_block_in_grid_min_content() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node1 = @@ -30,9 +25,9 @@ fn blockgrid_block_in_grid_min_content() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); diff --git a/tests/generated/blockgrid/blockgrid_grid_in_block.rs b/tests/generated/blockgrid/blockgrid_grid_in_block.rs index 6b6200e9f..8db8ba469 100644 --- a/tests/generated/blockgrid/blockgrid_grid_in_block.rs +++ b/tests/generated/blockgrid/blockgrid_grid_in_block.rs @@ -1,8 +1,8 @@ #[test] fn blockgrid_grid_in_block() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -38,9 +38,9 @@ fn blockgrid_grid_in_block() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/blockgrid/blockgrid_margin_y_collapse_through_blocked_by_grid.rs b/tests/generated/blockgrid/blockgrid_margin_y_collapse_through_blocked_by_grid.rs index fa813fdb8..c69bc2dcc 100644 --- a/tests/generated/blockgrid/blockgrid_margin_y_collapse_through_blocked_by_grid.rs +++ b/tests/generated/blockgrid/blockgrid_margin_y_collapse_through_blocked_by_grid.rs @@ -1,8 +1,8 @@ #[test] fn blockgrid_margin_y_collapse_through_blocked_by_grid() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, @@ -51,9 +51,9 @@ fn blockgrid_margin_y_collapse_through_blocked_by_grid() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/blockgrid/blockgrid_margin_y_first_child_collapse_blocked_by_grid.rs b/tests/generated/blockgrid/blockgrid_margin_y_first_child_collapse_blocked_by_grid.rs index ef578017a..4855bf7fc 100644 --- a/tests/generated/blockgrid/blockgrid_margin_y_first_child_collapse_blocked_by_grid.rs +++ b/tests/generated/blockgrid/blockgrid_margin_y_first_child_collapse_blocked_by_grid.rs @@ -1,8 +1,8 @@ #[test] fn blockgrid_margin_y_first_child_collapse_blocked_by_grid() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node000 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -49,9 +49,9 @@ fn blockgrid_margin_y_first_child_collapse_blocked_by_grid() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/blockgrid/blockgrid_margin_y_last_child_collapse_blocked_by_grid.rs b/tests/generated/blockgrid/blockgrid_margin_y_last_child_collapse_blocked_by_grid.rs index 9451053ac..b40d3c940 100644 --- a/tests/generated/blockgrid/blockgrid_margin_y_last_child_collapse_blocked_by_grid.rs +++ b/tests/generated/blockgrid/blockgrid_margin_y_last_child_collapse_blocked_by_grid.rs @@ -1,8 +1,8 @@ #[test] fn blockgrid_margin_y_last_child_collapse_blocked_by_grid() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node000 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -49,9 +49,9 @@ fn blockgrid_margin_y_last_child_collapse_blocked_by_grid() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/flex/absolute_aspect_ratio_aspect_ratio_overrides_height_of_full_inset.rs b/tests/generated/flex/absolute_aspect_ratio_aspect_ratio_overrides_height_of_full_inset.rs index 979f1891d..520b2d214 100644 --- a/tests/generated/flex/absolute_aspect_ratio_aspect_ratio_overrides_height_of_full_inset.rs +++ b/tests/generated/flex/absolute_aspect_ratio_aspect_ratio_overrides_height_of_full_inset.rs @@ -1,8 +1,8 @@ #[test] fn absolute_aspect_ratio_aspect_ratio_overrides_height_of_full_inset() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -29,9 +29,9 @@ fn absolute_aspect_ratio_aspect_ratio_overrides_height_of_full_inset() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); diff --git a/tests/generated/flex/absolute_aspect_ratio_fill_height.rs b/tests/generated/flex/absolute_aspect_ratio_fill_height.rs index dc1484041..d9ab20946 100644 --- a/tests/generated/flex/absolute_aspect_ratio_fill_height.rs +++ b/tests/generated/flex/absolute_aspect_ratio_fill_height.rs @@ -1,8 +1,8 @@ #[test] fn absolute_aspect_ratio_fill_height() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -30,9 +30,9 @@ fn absolute_aspect_ratio_fill_height() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); diff --git a/tests/generated/flex/absolute_aspect_ratio_fill_height_from_inset.rs b/tests/generated/flex/absolute_aspect_ratio_fill_height_from_inset.rs index b9dadd3d3..24eaeb18e 100644 --- a/tests/generated/flex/absolute_aspect_ratio_fill_height_from_inset.rs +++ b/tests/generated/flex/absolute_aspect_ratio_fill_height_from_inset.rs @@ -1,8 +1,8 @@ #[test] fn absolute_aspect_ratio_fill_height_from_inset() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -29,9 +29,9 @@ fn absolute_aspect_ratio_fill_height_from_inset() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); diff --git a/tests/generated/flex/absolute_aspect_ratio_fill_max_height.rs b/tests/generated/flex/absolute_aspect_ratio_fill_max_height.rs index 93f3f3521..111d5457e 100644 --- a/tests/generated/flex/absolute_aspect_ratio_fill_max_height.rs +++ b/tests/generated/flex/absolute_aspect_ratio_fill_max_height.rs @@ -1,9 +1,9 @@ #[test] fn absolute_aspect_ratio_fill_max_height() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); - let node0 = taffy . new_leaf_with_measure (taffy :: style :: Style { position : taffy :: style :: Position :: Absolute , max_size : taffy :: geometry :: Size { width : taffy :: style :: Dimension :: Length (50f32) , height : auto () , } , aspect_ratio : Some (3f32) , .. Default :: default () } , taffy :: tree :: MeasureFunc :: Raw (| known_dimensions , available_space | { const TEXT : & str = "HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH" ; crate :: measure_standard_text (known_dimensions , available_space , TEXT , crate :: WritingMode :: Horizontal , Some (3f32)) }) ,) . unwrap () ; + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); + let node0 = taffy . new_leaf_with_context (taffy :: style :: Style { position : taffy :: style :: Position :: Absolute , max_size : taffy :: geometry :: Size { width : taffy :: style :: Dimension :: Length (50f32) , height : auto () , } , aspect_ratio : Some (3f32) , .. Default :: default () } , crate :: TextMeasure { text_content : "HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH" , writing_mode : crate :: WritingMode :: Horizontal , _aspect_ratio : Some (3f32) , } ,) . unwrap () ; let node = taffy .new_with_children( taffy::style::Style { @@ -17,9 +17,9 @@ fn absolute_aspect_ratio_fill_max_height() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); diff --git a/tests/generated/flex/absolute_aspect_ratio_fill_max_width.rs b/tests/generated/flex/absolute_aspect_ratio_fill_max_width.rs index f49c5813d..fa9d4a44a 100644 --- a/tests/generated/flex/absolute_aspect_ratio_fill_max_width.rs +++ b/tests/generated/flex/absolute_aspect_ratio_fill_max_width.rs @@ -1,9 +1,9 @@ #[test] fn absolute_aspect_ratio_fill_max_width() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); - let node0 = taffy . new_leaf_with_measure (taffy :: style :: Style { position : taffy :: style :: Position :: Absolute , max_size : taffy :: geometry :: Size { width : auto () , height : taffy :: style :: Dimension :: Length (50f32) , } , aspect_ratio : Some (0.5f32) , .. Default :: default () } , taffy :: tree :: MeasureFunc :: Raw (| known_dimensions , available_space | { const TEXT : & str = "HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH" ; crate :: measure_standard_text (known_dimensions , available_space , TEXT , crate :: WritingMode :: Horizontal , Some (0.5f32)) }) ,) . unwrap () ; + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); + let node0 = taffy . new_leaf_with_context (taffy :: style :: Style { position : taffy :: style :: Position :: Absolute , max_size : taffy :: geometry :: Size { width : auto () , height : taffy :: style :: Dimension :: Length (50f32) , } , aspect_ratio : Some (0.5f32) , .. Default :: default () } , crate :: TextMeasure { text_content : "HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH" , writing_mode : crate :: WritingMode :: Horizontal , _aspect_ratio : Some (0.5f32) , } ,) . unwrap () ; let node = taffy .new_with_children( taffy::style::Style { @@ -17,9 +17,9 @@ fn absolute_aspect_ratio_fill_max_width() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); diff --git a/tests/generated/flex/absolute_aspect_ratio_fill_min_height.rs b/tests/generated/flex/absolute_aspect_ratio_fill_min_height.rs index 99c744c8e..99a02bb2d 100644 --- a/tests/generated/flex/absolute_aspect_ratio_fill_min_height.rs +++ b/tests/generated/flex/absolute_aspect_ratio_fill_min_height.rs @@ -1,8 +1,8 @@ #[test] fn absolute_aspect_ratio_fill_min_height() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -24,9 +24,9 @@ fn absolute_aspect_ratio_fill_min_height() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); diff --git a/tests/generated/flex/absolute_aspect_ratio_fill_min_width.rs b/tests/generated/flex/absolute_aspect_ratio_fill_min_width.rs index 09c215184..ffa7f0d4a 100644 --- a/tests/generated/flex/absolute_aspect_ratio_fill_min_width.rs +++ b/tests/generated/flex/absolute_aspect_ratio_fill_min_width.rs @@ -1,8 +1,8 @@ #[test] fn absolute_aspect_ratio_fill_min_width() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -24,9 +24,9 @@ fn absolute_aspect_ratio_fill_min_width() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); diff --git a/tests/generated/flex/absolute_aspect_ratio_fill_width.rs b/tests/generated/flex/absolute_aspect_ratio_fill_width.rs index a23b9fd14..89a30e6b7 100644 --- a/tests/generated/flex/absolute_aspect_ratio_fill_width.rs +++ b/tests/generated/flex/absolute_aspect_ratio_fill_width.rs @@ -1,8 +1,8 @@ #[test] fn absolute_aspect_ratio_fill_width() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -30,9 +30,9 @@ fn absolute_aspect_ratio_fill_width() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); diff --git a/tests/generated/flex/absolute_aspect_ratio_fill_width_from_inset.rs b/tests/generated/flex/absolute_aspect_ratio_fill_width_from_inset.rs index e1acc42f2..ca536ee5b 100644 --- a/tests/generated/flex/absolute_aspect_ratio_fill_width_from_inset.rs +++ b/tests/generated/flex/absolute_aspect_ratio_fill_width_from_inset.rs @@ -1,8 +1,8 @@ #[test] fn absolute_aspect_ratio_fill_width_from_inset() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -29,9 +29,9 @@ fn absolute_aspect_ratio_fill_width_from_inset() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); diff --git a/tests/generated/flex/absolute_aspect_ratio_height_overrides_inset.rs b/tests/generated/flex/absolute_aspect_ratio_height_overrides_inset.rs index 3a161c7f5..a2ff06122 100644 --- a/tests/generated/flex/absolute_aspect_ratio_height_overrides_inset.rs +++ b/tests/generated/flex/absolute_aspect_ratio_height_overrides_inset.rs @@ -1,8 +1,8 @@ #[test] fn absolute_aspect_ratio_height_overrides_inset() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -30,9 +30,9 @@ fn absolute_aspect_ratio_height_overrides_inset() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); diff --git a/tests/generated/flex/absolute_aspect_ratio_width_overrides_inset.rs b/tests/generated/flex/absolute_aspect_ratio_width_overrides_inset.rs index a37862f7c..2c28210dd 100644 --- a/tests/generated/flex/absolute_aspect_ratio_width_overrides_inset.rs +++ b/tests/generated/flex/absolute_aspect_ratio_width_overrides_inset.rs @@ -1,8 +1,8 @@ #[test] fn absolute_aspect_ratio_width_overrides_inset() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -30,9 +30,9 @@ fn absolute_aspect_ratio_width_overrides_inset() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); diff --git a/tests/generated/flex/absolute_child_with_cross_margin.rs b/tests/generated/flex/absolute_child_with_cross_margin.rs index 1d98b2cfa..900a96a51 100644 --- a/tests/generated/flex/absolute_child_with_cross_margin.rs +++ b/tests/generated/flex/absolute_child_with_cross_margin.rs @@ -1,8 +1,8 @@ #[test] fn absolute_child_with_cross_margin() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { align_content: Some(taffy::style::AlignContent::Stretch), @@ -14,7 +14,7 @@ fn absolute_child_with_cross_margin() { }) .unwrap(); let node1 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { position: taffy::style::Position::Absolute, align_content: Some(taffy::style::AlignContent::Stretch), @@ -32,16 +32,11 @@ fn absolute_child_with_cross_margin() { }, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "\n "; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "\n ", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node2 = taffy @@ -71,9 +66,9 @@ fn absolute_child_with_cross_margin() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 311f32, "width of node {:?}. Expected {}. Actual {}", node, 311f32, size.width); diff --git a/tests/generated/flex/absolute_child_with_main_margin.rs b/tests/generated/flex/absolute_child_with_main_margin.rs index 406f7bf11..a7cde69ad 100644 --- a/tests/generated/flex/absolute_child_with_main_margin.rs +++ b/tests/generated/flex/absolute_child_with_main_margin.rs @@ -1,8 +1,8 @@ #[test] fn absolute_child_with_main_margin() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -31,9 +31,9 @@ fn absolute_child_with_main_margin() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); diff --git a/tests/generated/flex/absolute_child_with_max_height.rs b/tests/generated/flex/absolute_child_with_max_height.rs index e0faf49ae..e70baeca4 100644 --- a/tests/generated/flex/absolute_child_with_max_height.rs +++ b/tests/generated/flex/absolute_child_with_max_height.rs @@ -1,8 +1,8 @@ #[test] fn absolute_child_with_max_height() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -42,9 +42,9 @@ fn absolute_child_with_max_height() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/absolute_child_with_max_height_larger_shrinkable_grandchild.rs b/tests/generated/flex/absolute_child_with_max_height_larger_shrinkable_grandchild.rs index cbb04af7e..94c6844f0 100644 --- a/tests/generated/flex/absolute_child_with_max_height_larger_shrinkable_grandchild.rs +++ b/tests/generated/flex/absolute_child_with_max_height_larger_shrinkable_grandchild.rs @@ -1,8 +1,8 @@ #[test] fn absolute_child_with_max_height_larger_shrinkable_grandchild() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { flex_shrink: 1f32, @@ -41,9 +41,9 @@ fn absolute_child_with_max_height_larger_shrinkable_grandchild() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/absolute_layout_align_items_and_justify_content_center.rs b/tests/generated/flex/absolute_layout_align_items_and_justify_content_center.rs index fa6cafcce..2473f3153 100644 --- a/tests/generated/flex/absolute_layout_align_items_and_justify_content_center.rs +++ b/tests/generated/flex/absolute_layout_align_items_and_justify_content_center.rs @@ -1,8 +1,8 @@ #[test] fn absolute_layout_align_items_and_justify_content_center() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -27,9 +27,9 @@ fn absolute_layout_align_items_and_justify_content_center() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 110f32, "width of node {:?}. Expected {}. Actual {}", node, 110f32, size.width); diff --git a/tests/generated/flex/absolute_layout_align_items_and_justify_content_center_and_bottom_position.rs b/tests/generated/flex/absolute_layout_align_items_and_justify_content_center_and_bottom_position.rs index 405e329fb..158dde8c2 100644 --- a/tests/generated/flex/absolute_layout_align_items_and_justify_content_center_and_bottom_position.rs +++ b/tests/generated/flex/absolute_layout_align_items_and_justify_content_center_and_bottom_position.rs @@ -1,8 +1,8 @@ #[test] fn absolute_layout_align_items_and_justify_content_center_and_bottom_position() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -33,9 +33,9 @@ fn absolute_layout_align_items_and_justify_content_center_and_bottom_position() &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 110f32, "width of node {:?}. Expected {}. Actual {}", node, 110f32, size.width); diff --git a/tests/generated/flex/absolute_layout_align_items_and_justify_content_center_and_left_position.rs b/tests/generated/flex/absolute_layout_align_items_and_justify_content_center_and_left_position.rs index 7a97d3fe3..5f2d0357c 100644 --- a/tests/generated/flex/absolute_layout_align_items_and_justify_content_center_and_left_position.rs +++ b/tests/generated/flex/absolute_layout_align_items_and_justify_content_center_and_left_position.rs @@ -1,8 +1,8 @@ #[test] fn absolute_layout_align_items_and_justify_content_center_and_left_position() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -33,9 +33,9 @@ fn absolute_layout_align_items_and_justify_content_center_and_left_position() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 110f32, "width of node {:?}. Expected {}. Actual {}", node, 110f32, size.width); diff --git a/tests/generated/flex/absolute_layout_align_items_and_justify_content_center_and_right_position.rs b/tests/generated/flex/absolute_layout_align_items_and_justify_content_center_and_right_position.rs index ae9164b75..b8ffc60e4 100644 --- a/tests/generated/flex/absolute_layout_align_items_and_justify_content_center_and_right_position.rs +++ b/tests/generated/flex/absolute_layout_align_items_and_justify_content_center_and_right_position.rs @@ -1,8 +1,8 @@ #[test] fn absolute_layout_align_items_and_justify_content_center_and_right_position() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -33,9 +33,9 @@ fn absolute_layout_align_items_and_justify_content_center_and_right_position() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 110f32, "width of node {:?}. Expected {}. Actual {}", node, 110f32, size.width); diff --git a/tests/generated/flex/absolute_layout_align_items_and_justify_content_center_and_top_position.rs b/tests/generated/flex/absolute_layout_align_items_and_justify_content_center_and_top_position.rs index 75e504fd9..4c9c06193 100644 --- a/tests/generated/flex/absolute_layout_align_items_and_justify_content_center_and_top_position.rs +++ b/tests/generated/flex/absolute_layout_align_items_and_justify_content_center_and_top_position.rs @@ -1,8 +1,8 @@ #[test] fn absolute_layout_align_items_and_justify_content_center_and_top_position() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -33,9 +33,9 @@ fn absolute_layout_align_items_and_justify_content_center_and_top_position() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 110f32, "width of node {:?}. Expected {}. Actual {}", node, 110f32, size.width); diff --git a/tests/generated/flex/absolute_layout_align_items_and_justify_content_flex_end.rs b/tests/generated/flex/absolute_layout_align_items_and_justify_content_flex_end.rs index 4394e23e5..0a623aebb 100644 --- a/tests/generated/flex/absolute_layout_align_items_and_justify_content_flex_end.rs +++ b/tests/generated/flex/absolute_layout_align_items_and_justify_content_flex_end.rs @@ -1,8 +1,8 @@ #[test] fn absolute_layout_align_items_and_justify_content_flex_end() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -27,9 +27,9 @@ fn absolute_layout_align_items_and_justify_content_flex_end() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 110f32, "width of node {:?}. Expected {}. Actual {}", node, 110f32, size.width); diff --git a/tests/generated/flex/absolute_layout_align_items_center.rs b/tests/generated/flex/absolute_layout_align_items_center.rs index 3528b5719..88e8ff71f 100644 --- a/tests/generated/flex/absolute_layout_align_items_center.rs +++ b/tests/generated/flex/absolute_layout_align_items_center.rs @@ -1,8 +1,8 @@ #[test] fn absolute_layout_align_items_center() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -26,9 +26,9 @@ fn absolute_layout_align_items_center() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 110f32, "width of node {:?}. Expected {}. Actual {}", node, 110f32, size.width); diff --git a/tests/generated/flex/absolute_layout_align_items_center_on_child_only.rs b/tests/generated/flex/absolute_layout_align_items_center_on_child_only.rs index 078cd2477..12660a862 100644 --- a/tests/generated/flex/absolute_layout_align_items_center_on_child_only.rs +++ b/tests/generated/flex/absolute_layout_align_items_center_on_child_only.rs @@ -1,8 +1,8 @@ #[test] fn absolute_layout_align_items_center_on_child_only() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -26,9 +26,9 @@ fn absolute_layout_align_items_center_on_child_only() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 110f32, "width of node {:?}. Expected {}. Actual {}", node, 110f32, size.width); diff --git a/tests/generated/flex/absolute_layout_child_order.rs b/tests/generated/flex/absolute_layout_child_order.rs index 002bba63c..c0417f793 100644 --- a/tests/generated/flex/absolute_layout_child_order.rs +++ b/tests/generated/flex/absolute_layout_child_order.rs @@ -1,8 +1,8 @@ #[test] fn absolute_layout_child_order() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -45,9 +45,9 @@ fn absolute_layout_child_order() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 110f32, "width of node {:?}. Expected {}. Actual {}", node, 110f32, size.width); diff --git a/tests/generated/flex/absolute_layout_in_wrap_reverse_column_container.rs b/tests/generated/flex/absolute_layout_in_wrap_reverse_column_container.rs index 2dc77dbc2..1c2c64f37 100644 --- a/tests/generated/flex/absolute_layout_in_wrap_reverse_column_container.rs +++ b/tests/generated/flex/absolute_layout_in_wrap_reverse_column_container.rs @@ -1,8 +1,8 @@ #[test] fn absolute_layout_in_wrap_reverse_column_container() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -27,9 +27,9 @@ fn absolute_layout_in_wrap_reverse_column_container() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/absolute_layout_in_wrap_reverse_column_container_flex_end.rs b/tests/generated/flex/absolute_layout_in_wrap_reverse_column_container_flex_end.rs index 3b5289149..7f3048c28 100644 --- a/tests/generated/flex/absolute_layout_in_wrap_reverse_column_container_flex_end.rs +++ b/tests/generated/flex/absolute_layout_in_wrap_reverse_column_container_flex_end.rs @@ -1,8 +1,8 @@ #[test] fn absolute_layout_in_wrap_reverse_column_container_flex_end() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -28,9 +28,9 @@ fn absolute_layout_in_wrap_reverse_column_container_flex_end() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/absolute_layout_in_wrap_reverse_row_container.rs b/tests/generated/flex/absolute_layout_in_wrap_reverse_row_container.rs index dda7e62b2..f2de98e53 100644 --- a/tests/generated/flex/absolute_layout_in_wrap_reverse_row_container.rs +++ b/tests/generated/flex/absolute_layout_in_wrap_reverse_row_container.rs @@ -1,8 +1,8 @@ #[test] fn absolute_layout_in_wrap_reverse_row_container() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -26,9 +26,9 @@ fn absolute_layout_in_wrap_reverse_row_container() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/absolute_layout_in_wrap_reverse_row_container_flex_end.rs b/tests/generated/flex/absolute_layout_in_wrap_reverse_row_container_flex_end.rs index 919860620..747383ad4 100644 --- a/tests/generated/flex/absolute_layout_in_wrap_reverse_row_container_flex_end.rs +++ b/tests/generated/flex/absolute_layout_in_wrap_reverse_row_container_flex_end.rs @@ -1,8 +1,8 @@ #[test] fn absolute_layout_in_wrap_reverse_row_container_flex_end() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -27,9 +27,9 @@ fn absolute_layout_in_wrap_reverse_row_container_flex_end() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/absolute_layout_justify_content_center.rs b/tests/generated/flex/absolute_layout_justify_content_center.rs index 5457421ad..4b3da6ac9 100644 --- a/tests/generated/flex/absolute_layout_justify_content_center.rs +++ b/tests/generated/flex/absolute_layout_justify_content_center.rs @@ -1,8 +1,8 @@ #[test] fn absolute_layout_justify_content_center() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -26,9 +26,9 @@ fn absolute_layout_justify_content_center() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 110f32, "width of node {:?}. Expected {}. Actual {}", node, 110f32, size.width); diff --git a/tests/generated/flex/absolute_layout_no_size.rs b/tests/generated/flex/absolute_layout_no_size.rs index 11bddf745..a206a9f47 100644 --- a/tests/generated/flex/absolute_layout_no_size.rs +++ b/tests/generated/flex/absolute_layout_no_size.rs @@ -1,8 +1,8 @@ #[test] fn absolute_layout_no_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, ..Default::default() }) .unwrap(); @@ -18,9 +18,9 @@ fn absolute_layout_no_size() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/absolute_layout_percentage_bottom_based_on_parent_height.rs b/tests/generated/flex/absolute_layout_percentage_bottom_based_on_parent_height.rs index 86edace6d..d1d09b574 100644 --- a/tests/generated/flex/absolute_layout_percentage_bottom_based_on_parent_height.rs +++ b/tests/generated/flex/absolute_layout_percentage_bottom_based_on_parent_height.rs @@ -1,8 +1,8 @@ #[test] fn absolute_layout_percentage_bottom_based_on_parent_height() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -60,9 +60,9 @@ fn absolute_layout_percentage_bottom_based_on_parent_height() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/absolute_layout_percentage_height.rs b/tests/generated/flex/absolute_layout_percentage_height.rs index 642bde4e6..57a15bc69 100644 --- a/tests/generated/flex/absolute_layout_percentage_height.rs +++ b/tests/generated/flex/absolute_layout_percentage_height.rs @@ -1,8 +1,8 @@ #[test] fn absolute_layout_percentage_height() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -31,9 +31,9 @@ fn absolute_layout_percentage_height() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/flex/absolute_layout_row_width_height_end_bottom.rs b/tests/generated/flex/absolute_layout_row_width_height_end_bottom.rs index 2ec9644ff..1d3ceb0ba 100644 --- a/tests/generated/flex/absolute_layout_row_width_height_end_bottom.rs +++ b/tests/generated/flex/absolute_layout_row_width_height_end_bottom.rs @@ -1,8 +1,8 @@ #[test] fn absolute_layout_row_width_height_end_bottom() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -31,9 +31,9 @@ fn absolute_layout_row_width_height_end_bottom() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/absolute_layout_start_top_end_bottom.rs b/tests/generated/flex/absolute_layout_start_top_end_bottom.rs index 78baeeb19..161af82ee 100644 --- a/tests/generated/flex/absolute_layout_start_top_end_bottom.rs +++ b/tests/generated/flex/absolute_layout_start_top_end_bottom.rs @@ -1,8 +1,8 @@ #[test] fn absolute_layout_start_top_end_bottom() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -27,9 +27,9 @@ fn absolute_layout_start_top_end_bottom() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/absolute_layout_width_height_end_bottom.rs b/tests/generated/flex/absolute_layout_width_height_end_bottom.rs index b220f4716..9fa6b241b 100644 --- a/tests/generated/flex/absolute_layout_width_height_end_bottom.rs +++ b/tests/generated/flex/absolute_layout_width_height_end_bottom.rs @@ -1,8 +1,8 @@ #[test] fn absolute_layout_width_height_end_bottom() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -31,9 +31,9 @@ fn absolute_layout_width_height_end_bottom() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/absolute_layout_width_height_start_top.rs b/tests/generated/flex/absolute_layout_width_height_start_top.rs index 3e6e0bf2a..6810b77c7 100644 --- a/tests/generated/flex/absolute_layout_width_height_start_top.rs +++ b/tests/generated/flex/absolute_layout_width_height_start_top.rs @@ -1,8 +1,8 @@ #[test] fn absolute_layout_width_height_start_top() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -31,9 +31,9 @@ fn absolute_layout_width_height_start_top() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/absolute_layout_width_height_start_top_end_bottom.rs b/tests/generated/flex/absolute_layout_width_height_start_top_end_bottom.rs index 104639876..1d6b4b4e3 100644 --- a/tests/generated/flex/absolute_layout_width_height_start_top_end_bottom.rs +++ b/tests/generated/flex/absolute_layout_width_height_start_top_end_bottom.rs @@ -1,8 +1,8 @@ #[test] fn absolute_layout_width_height_start_top_end_bottom() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -31,9 +31,9 @@ fn absolute_layout_width_height_start_top_end_bottom() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/absolute_layout_within_border.rs b/tests/generated/flex/absolute_layout_within_border.rs index c1d50b1c4..97257973c 100644 --- a/tests/generated/flex/absolute_layout_within_border.rs +++ b/tests/generated/flex/absolute_layout_within_border.rs @@ -1,8 +1,8 @@ #[test] fn absolute_layout_within_border() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -103,9 +103,9 @@ fn absolute_layout_within_border() { &[node0, node1, node2, node3], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/absolute_margin_bottom_left.rs b/tests/generated/flex/absolute_margin_bottom_left.rs index e791ce6d6..124a57ed9 100644 --- a/tests/generated/flex/absolute_margin_bottom_left.rs +++ b/tests/generated/flex/absolute_margin_bottom_left.rs @@ -1,8 +1,8 @@ #[test] fn absolute_margin_bottom_left() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -33,9 +33,9 @@ fn absolute_margin_bottom_left() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/absolute_minmax_bottom_right_max.rs b/tests/generated/flex/absolute_minmax_bottom_right_max.rs index 6827c06cc..46f04727e 100644 --- a/tests/generated/flex/absolute_minmax_bottom_right_max.rs +++ b/tests/generated/flex/absolute_minmax_bottom_right_max.rs @@ -1,8 +1,8 @@ #[test] fn absolute_minmax_bottom_right_max() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -35,9 +35,9 @@ fn absolute_minmax_bottom_right_max() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/absolute_minmax_bottom_right_min_max.rs b/tests/generated/flex/absolute_minmax_bottom_right_min_max.rs index c9c8d6cc7..03604f536 100644 --- a/tests/generated/flex/absolute_minmax_bottom_right_min_max.rs +++ b/tests/generated/flex/absolute_minmax_bottom_right_min_max.rs @@ -1,8 +1,8 @@ #[test] fn absolute_minmax_bottom_right_min_max() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -35,9 +35,9 @@ fn absolute_minmax_bottom_right_min_max() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/absolute_minmax_bottom_right_min_max_preferred.rs b/tests/generated/flex/absolute_minmax_bottom_right_min_max_preferred.rs index 769eb9190..5dc40e2fa 100644 --- a/tests/generated/flex/absolute_minmax_bottom_right_min_max_preferred.rs +++ b/tests/generated/flex/absolute_minmax_bottom_right_min_max_preferred.rs @@ -1,8 +1,8 @@ #[test] fn absolute_minmax_bottom_right_min_max_preferred() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -39,9 +39,9 @@ fn absolute_minmax_bottom_right_min_max_preferred() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/absolute_minmax_top_left_bottom_right_max.rs b/tests/generated/flex/absolute_minmax_top_left_bottom_right_max.rs index 4f84b1cf1..29b095e0f 100644 --- a/tests/generated/flex/absolute_minmax_top_left_bottom_right_max.rs +++ b/tests/generated/flex/absolute_minmax_top_left_bottom_right_max.rs @@ -1,8 +1,8 @@ #[test] fn absolute_minmax_top_left_bottom_right_max() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -31,9 +31,9 @@ fn absolute_minmax_top_left_bottom_right_max() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/absolute_minmax_top_left_bottom_right_min_max.rs b/tests/generated/flex/absolute_minmax_top_left_bottom_right_min_max.rs index abb7c28e4..04c6465c0 100644 --- a/tests/generated/flex/absolute_minmax_top_left_bottom_right_min_max.rs +++ b/tests/generated/flex/absolute_minmax_top_left_bottom_right_min_max.rs @@ -1,8 +1,8 @@ #[test] fn absolute_minmax_top_left_bottom_right_min_max() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -35,9 +35,9 @@ fn absolute_minmax_top_left_bottom_right_min_max() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/absolute_padding_border_overrides_max_size.rs b/tests/generated/flex/absolute_padding_border_overrides_max_size.rs index 33dd447bf..83a04c0e2 100644 --- a/tests/generated/flex/absolute_padding_border_overrides_max_size.rs +++ b/tests/generated/flex/absolute_padding_border_overrides_max_size.rs @@ -1,8 +1,8 @@ #[test] fn absolute_padding_border_overrides_max_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -26,9 +26,9 @@ fn absolute_padding_border_overrides_max_size() { }) .unwrap(); let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0]).unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); diff --git a/tests/generated/flex/absolute_padding_border_overrides_size.rs b/tests/generated/flex/absolute_padding_border_overrides_size.rs index 7dc0ab03f..494834cce 100644 --- a/tests/generated/flex/absolute_padding_border_overrides_size.rs +++ b/tests/generated/flex/absolute_padding_border_overrides_size.rs @@ -1,8 +1,8 @@ #[test] fn absolute_padding_border_overrides_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -26,9 +26,9 @@ fn absolute_padding_border_overrides_size() { }) .unwrap(); let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0]).unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); diff --git a/tests/generated/flex/align_baseline.rs b/tests/generated/flex/align_baseline.rs index f7ed9ea04..c51ea1a9e 100644 --- a/tests/generated/flex/align_baseline.rs +++ b/tests/generated/flex/align_baseline.rs @@ -1,8 +1,8 @@ #[test] fn align_baseline() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -34,9 +34,9 @@ fn align_baseline() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/align_baseline_child.rs b/tests/generated/flex/align_baseline_child.rs index 82bf24b3c..2fb06f516 100644 --- a/tests/generated/flex/align_baseline_child.rs +++ b/tests/generated/flex/align_baseline_child.rs @@ -1,8 +1,8 @@ #[test] fn align_baseline_child() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -47,9 +47,9 @@ fn align_baseline_child() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/align_baseline_child_margin.rs b/tests/generated/flex/align_baseline_child_margin.rs index 18f25a9d6..ecba950d9 100644 --- a/tests/generated/flex/align_baseline_child_margin.rs +++ b/tests/generated/flex/align_baseline_child_margin.rs @@ -1,8 +1,8 @@ #[test] fn align_baseline_child_margin() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -59,9 +59,9 @@ fn align_baseline_child_margin() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/align_baseline_child_margin_percent.rs b/tests/generated/flex/align_baseline_child_margin_percent.rs index b183d984a..23287e07d 100644 --- a/tests/generated/flex/align_baseline_child_margin_percent.rs +++ b/tests/generated/flex/align_baseline_child_margin_percent.rs @@ -1,8 +1,8 @@ #[test] fn align_baseline_child_margin_percent() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -59,9 +59,9 @@ fn align_baseline_child_margin_percent() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/align_baseline_child_multiline.rs b/tests/generated/flex/align_baseline_child_multiline.rs index f33ea18e9..5ca15d6ad 100644 --- a/tests/generated/flex/align_baseline_child_multiline.rs +++ b/tests/generated/flex/align_baseline_child_multiline.rs @@ -1,8 +1,8 @@ #[test] fn align_baseline_child_multiline() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -68,9 +68,9 @@ fn align_baseline_child_multiline() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/align_baseline_child_multiline_no_override_on_secondline.rs b/tests/generated/flex/align_baseline_child_multiline_no_override_on_secondline.rs index c64ce4b46..a9eb472f3 100644 --- a/tests/generated/flex/align_baseline_child_multiline_no_override_on_secondline.rs +++ b/tests/generated/flex/align_baseline_child_multiline_no_override_on_secondline.rs @@ -1,8 +1,8 @@ #[test] fn align_baseline_child_multiline_no_override_on_secondline() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -75,9 +75,9 @@ fn align_baseline_child_multiline_no_override_on_secondline() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/align_baseline_child_multiline_override.rs b/tests/generated/flex/align_baseline_child_multiline_override.rs index ee7a9d3ae..e9a4e3dd8 100644 --- a/tests/generated/flex/align_baseline_child_multiline_override.rs +++ b/tests/generated/flex/align_baseline_child_multiline_override.rs @@ -1,8 +1,8 @@ #[test] fn align_baseline_child_multiline_override() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -76,9 +76,9 @@ fn align_baseline_child_multiline_override() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/align_baseline_child_padding.rs b/tests/generated/flex/align_baseline_child_padding.rs index 5ee601d04..dad0dd906 100644 --- a/tests/generated/flex/align_baseline_child_padding.rs +++ b/tests/generated/flex/align_baseline_child_padding.rs @@ -1,8 +1,8 @@ #[test] fn align_baseline_child_padding() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -59,9 +59,9 @@ fn align_baseline_child_padding() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/align_baseline_child_top.rs b/tests/generated/flex/align_baseline_child_top.rs index 4957b2eb2..7c1959621 100644 --- a/tests/generated/flex/align_baseline_child_top.rs +++ b/tests/generated/flex/align_baseline_child_top.rs @@ -1,8 +1,8 @@ #[test] fn align_baseline_child_top() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -53,9 +53,9 @@ fn align_baseline_child_top() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/align_baseline_child_top2.rs b/tests/generated/flex/align_baseline_child_top2.rs index 92cfe0d32..e81f925c1 100644 --- a/tests/generated/flex/align_baseline_child_top2.rs +++ b/tests/generated/flex/align_baseline_child_top2.rs @@ -1,8 +1,8 @@ #[test] fn align_baseline_child_top2() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -52,9 +52,9 @@ fn align_baseline_child_top2() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/align_baseline_column.rs b/tests/generated/flex/align_baseline_column.rs index 9782cc2c1..9ef6e6eae 100644 --- a/tests/generated/flex/align_baseline_column.rs +++ b/tests/generated/flex/align_baseline_column.rs @@ -1,8 +1,8 @@ #[test] fn align_baseline_column() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -35,9 +35,9 @@ fn align_baseline_column() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/align_baseline_double_nested_child.rs b/tests/generated/flex/align_baseline_double_nested_child.rs index 081ae54af..507fbbe5c 100644 --- a/tests/generated/flex/align_baseline_double_nested_child.rs +++ b/tests/generated/flex/align_baseline_double_nested_child.rs @@ -1,8 +1,8 @@ #[test] fn align_baseline_double_nested_child() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -58,9 +58,9 @@ fn align_baseline_double_nested_child() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/align_baseline_multiline.rs b/tests/generated/flex/align_baseline_multiline.rs index f1edda44d..058517ace 100644 --- a/tests/generated/flex/align_baseline_multiline.rs +++ b/tests/generated/flex/align_baseline_multiline.rs @@ -1,8 +1,8 @@ #[test] fn align_baseline_multiline() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -79,9 +79,9 @@ fn align_baseline_multiline() { &[node0, node1, node2, node3], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/align_baseline_multiline_column.rs b/tests/generated/flex/align_baseline_multiline_column.rs index e8009d660..f17e1db79 100644 --- a/tests/generated/flex/align_baseline_multiline_column.rs +++ b/tests/generated/flex/align_baseline_multiline_column.rs @@ -1,8 +1,8 @@ #[test] fn align_baseline_multiline_column() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -80,9 +80,9 @@ fn align_baseline_multiline_column() { &[node0, node1, node2, node3], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/align_baseline_multiline_column2.rs b/tests/generated/flex/align_baseline_multiline_column2.rs index b05937223..d470ccbde 100644 --- a/tests/generated/flex/align_baseline_multiline_column2.rs +++ b/tests/generated/flex/align_baseline_multiline_column2.rs @@ -1,8 +1,8 @@ #[test] fn align_baseline_multiline_column2() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, @@ -84,9 +84,9 @@ fn align_baseline_multiline_column2() { &[node0, node1, node2, node3], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/align_baseline_multiline_row_and_column.rs b/tests/generated/flex/align_baseline_multiline_row_and_column.rs index 59d3934fe..bc089d231 100644 --- a/tests/generated/flex/align_baseline_multiline_row_and_column.rs +++ b/tests/generated/flex/align_baseline_multiline_row_and_column.rs @@ -1,8 +1,8 @@ #[test] fn align_baseline_multiline_row_and_column() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -79,9 +79,9 @@ fn align_baseline_multiline_row_and_column() { &[node0, node1, node2, node3], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/align_baseline_nested_child.rs b/tests/generated/flex/align_baseline_nested_child.rs index 01fc93357..31794af6c 100644 --- a/tests/generated/flex/align_baseline_nested_child.rs +++ b/tests/generated/flex/align_baseline_nested_child.rs @@ -1,8 +1,8 @@ #[test] fn align_baseline_nested_child() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -47,9 +47,9 @@ fn align_baseline_nested_child() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/align_baseline_nested_column.rs b/tests/generated/flex/align_baseline_nested_column.rs index 93571481f..756d9c123 100644 --- a/tests/generated/flex/align_baseline_nested_column.rs +++ b/tests/generated/flex/align_baseline_nested_column.rs @@ -1,8 +1,8 @@ #[test] fn align_baseline_nested_column() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -64,9 +64,9 @@ fn align_baseline_nested_column() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/align_center_should_size_based_on_content.rs b/tests/generated/flex/align_center_should_size_based_on_content.rs index a4738bf74..94f946c46 100644 --- a/tests/generated/flex/align_center_should_size_based_on_content.rs +++ b/tests/generated/flex/align_center_should_size_based_on_content.rs @@ -1,8 +1,8 @@ #[test] fn align_center_should_size_based_on_content() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node000 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -39,9 +39,9 @@ fn align_center_should_size_based_on_content() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/align_content_center_single_line.rs b/tests/generated/flex/align_content_center_single_line.rs index 58adff549..ed7ced83d 100644 --- a/tests/generated/flex/align_content_center_single_line.rs +++ b/tests/generated/flex/align_content_center_single_line.rs @@ -1,8 +1,8 @@ #[test] fn align_content_center_single_line() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -70,9 +70,9 @@ fn align_content_center_single_line() { &[node0, node1, node2, node3, node4, node5], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); diff --git a/tests/generated/flex/align_content_center_single_line_negative_space.rs b/tests/generated/flex/align_content_center_single_line_negative_space.rs index dffc12947..8a4477839 100644 --- a/tests/generated/flex/align_content_center_single_line_negative_space.rs +++ b/tests/generated/flex/align_content_center_single_line_negative_space.rs @@ -1,8 +1,8 @@ #[test] fn align_content_center_single_line_negative_space() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { flex_shrink: 0f32, @@ -45,9 +45,9 @@ fn align_content_center_single_line_negative_space() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); diff --git a/tests/generated/flex/align_content_center_single_line_negative_space_gap.rs b/tests/generated/flex/align_content_center_single_line_negative_space_gap.rs index 2aa523b2c..52690d4d6 100644 --- a/tests/generated/flex/align_content_center_single_line_negative_space_gap.rs +++ b/tests/generated/flex/align_content_center_single_line_negative_space_gap.rs @@ -1,8 +1,8 @@ #[test] fn align_content_center_single_line_negative_space_gap() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { flex_shrink: 0f32, @@ -49,9 +49,9 @@ fn align_content_center_single_line_negative_space_gap() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); diff --git a/tests/generated/flex/align_content_center_wrapped.rs b/tests/generated/flex/align_content_center_wrapped.rs index 159160700..378207d6b 100644 --- a/tests/generated/flex/align_content_center_wrapped.rs +++ b/tests/generated/flex/align_content_center_wrapped.rs @@ -1,8 +1,8 @@ #[test] fn align_content_center_wrapped() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -71,9 +71,9 @@ fn align_content_center_wrapped() { &[node0, node1, node2, node3, node4, node5], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); diff --git a/tests/generated/flex/align_content_center_wrapped_negative_space.rs b/tests/generated/flex/align_content_center_wrapped_negative_space.rs index 20b1b51ae..66f267e26 100644 --- a/tests/generated/flex/align_content_center_wrapped_negative_space.rs +++ b/tests/generated/flex/align_content_center_wrapped_negative_space.rs @@ -1,8 +1,8 @@ #[test] fn align_content_center_wrapped_negative_space() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { flex_shrink: 0f32, @@ -66,9 +66,9 @@ fn align_content_center_wrapped_negative_space() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); diff --git a/tests/generated/flex/align_content_center_wrapped_negative_space_gap.rs b/tests/generated/flex/align_content_center_wrapped_negative_space_gap.rs index 99536bbfc..66bc81c5c 100644 --- a/tests/generated/flex/align_content_center_wrapped_negative_space_gap.rs +++ b/tests/generated/flex/align_content_center_wrapped_negative_space_gap.rs @@ -1,8 +1,8 @@ #[test] fn align_content_center_wrapped_negative_space_gap() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { flex_shrink: 0f32, @@ -70,9 +70,9 @@ fn align_content_center_wrapped_negative_space_gap() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); diff --git a/tests/generated/flex/align_content_end.rs b/tests/generated/flex/align_content_end.rs index 82bf7c828..77019a7ca 100644 --- a/tests/generated/flex/align_content_end.rs +++ b/tests/generated/flex/align_content_end.rs @@ -1,8 +1,8 @@ #[test] fn align_content_end() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -63,9 +63,9 @@ fn align_content_end() { &[node0, node1, node2, node3, node4], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/align_content_end_single_line_negative_space.rs b/tests/generated/flex/align_content_end_single_line_negative_space.rs index b8493e58d..92308c98a 100644 --- a/tests/generated/flex/align_content_end_single_line_negative_space.rs +++ b/tests/generated/flex/align_content_end_single_line_negative_space.rs @@ -1,8 +1,8 @@ #[test] fn align_content_end_single_line_negative_space() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { flex_shrink: 0f32, @@ -45,9 +45,9 @@ fn align_content_end_single_line_negative_space() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); diff --git a/tests/generated/flex/align_content_end_single_line_negative_space_gap.rs b/tests/generated/flex/align_content_end_single_line_negative_space_gap.rs index d6e051c5d..d690b4be2 100644 --- a/tests/generated/flex/align_content_end_single_line_negative_space_gap.rs +++ b/tests/generated/flex/align_content_end_single_line_negative_space_gap.rs @@ -1,8 +1,8 @@ #[test] fn align_content_end_single_line_negative_space_gap() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { flex_shrink: 0f32, @@ -49,9 +49,9 @@ fn align_content_end_single_line_negative_space_gap() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); diff --git a/tests/generated/flex/align_content_end_wrapped_negative_space.rs b/tests/generated/flex/align_content_end_wrapped_negative_space.rs index 1dede69f6..ffe5b5fbc 100644 --- a/tests/generated/flex/align_content_end_wrapped_negative_space.rs +++ b/tests/generated/flex/align_content_end_wrapped_negative_space.rs @@ -1,8 +1,8 @@ #[test] fn align_content_end_wrapped_negative_space() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { flex_shrink: 0f32, @@ -66,9 +66,9 @@ fn align_content_end_wrapped_negative_space() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); diff --git a/tests/generated/flex/align_content_end_wrapped_negative_space_gap.rs b/tests/generated/flex/align_content_end_wrapped_negative_space_gap.rs index 360e0bc4f..c49b5392f 100644 --- a/tests/generated/flex/align_content_end_wrapped_negative_space_gap.rs +++ b/tests/generated/flex/align_content_end_wrapped_negative_space_gap.rs @@ -1,8 +1,8 @@ #[test] fn align_content_end_wrapped_negative_space_gap() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { flex_shrink: 0f32, @@ -70,9 +70,9 @@ fn align_content_end_wrapped_negative_space_gap() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); diff --git a/tests/generated/flex/align_content_flex_end.rs b/tests/generated/flex/align_content_flex_end.rs index 926ae4bfa..5c531481b 100644 --- a/tests/generated/flex/align_content_flex_end.rs +++ b/tests/generated/flex/align_content_flex_end.rs @@ -1,8 +1,8 @@ #[test] fn align_content_flex_end() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -63,9 +63,9 @@ fn align_content_flex_end() { &[node0, node1, node2, node3, node4], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/align_content_flex_start.rs b/tests/generated/flex/align_content_flex_start.rs index 640ba1abc..29bbcc23f 100644 --- a/tests/generated/flex/align_content_flex_start.rs +++ b/tests/generated/flex/align_content_flex_start.rs @@ -1,8 +1,8 @@ #[test] fn align_content_flex_start() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -62,9 +62,9 @@ fn align_content_flex_start() { &[node0, node1, node2, node3, node4], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 130f32, "width of node {:?}. Expected {}. Actual {}", node, 130f32, size.width); diff --git a/tests/generated/flex/align_content_flex_start_with_flex.rs b/tests/generated/flex/align_content_flex_start_with_flex.rs index dccae05ed..265b66dee 100644 --- a/tests/generated/flex/align_content_flex_start_with_flex.rs +++ b/tests/generated/flex/align_content_flex_start_with_flex.rs @@ -1,8 +1,8 @@ #[test] fn align_content_flex_start_with_flex() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_grow: 1f32, @@ -60,9 +60,9 @@ fn align_content_flex_start_with_flex() { &[node0, node1, node2, node3, node4], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/align_content_flex_start_without_height_on_children.rs b/tests/generated/flex/align_content_flex_start_without_height_on_children.rs index b73d5931a..f256481cc 100644 --- a/tests/generated/flex/align_content_flex_start_without_height_on_children.rs +++ b/tests/generated/flex/align_content_flex_start_without_height_on_children.rs @@ -1,8 +1,8 @@ #[test] fn align_content_flex_start_without_height_on_children() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Length(50f32), height: auto() }, @@ -54,9 +54,9 @@ fn align_content_flex_start_without_height_on_children() { &[node0, node1, node2, node3, node4], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/align_content_not_stretch_with_align_items_stretch.rs b/tests/generated/flex/align_content_not_stretch_with_align_items_stretch.rs index bb34f11ef..174ff93a2 100644 --- a/tests/generated/flex/align_content_not_stretch_with_align_items_stretch.rs +++ b/tests/generated/flex/align_content_not_stretch_with_align_items_stretch.rs @@ -1,8 +1,8 @@ #[test] fn align_content_not_stretch_with_align_items_stretch() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -47,9 +47,9 @@ fn align_content_not_stretch_with_align_items_stretch() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 328f32, "width of node {:?}. Expected {}. Actual {}", node, 328f32, size.width); diff --git a/tests/generated/flex/align_content_space_around_single_line.rs b/tests/generated/flex/align_content_space_around_single_line.rs index 8b7116b96..f994b5fda 100644 --- a/tests/generated/flex/align_content_space_around_single_line.rs +++ b/tests/generated/flex/align_content_space_around_single_line.rs @@ -1,8 +1,8 @@ #[test] fn align_content_space_around_single_line() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -70,9 +70,9 @@ fn align_content_space_around_single_line() { &[node0, node1, node2, node3, node4, node5], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/align_content_space_around_single_line_negative_space.rs b/tests/generated/flex/align_content_space_around_single_line_negative_space.rs index d62bf7f86..ebf0e9dfa 100644 --- a/tests/generated/flex/align_content_space_around_single_line_negative_space.rs +++ b/tests/generated/flex/align_content_space_around_single_line_negative_space.rs @@ -1,8 +1,8 @@ #[test] fn align_content_space_around_single_line_negative_space() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { flex_shrink: 0f32, @@ -45,9 +45,9 @@ fn align_content_space_around_single_line_negative_space() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); diff --git a/tests/generated/flex/align_content_space_around_single_line_negative_space_gap.rs b/tests/generated/flex/align_content_space_around_single_line_negative_space_gap.rs index 382e03a48..63b76babb 100644 --- a/tests/generated/flex/align_content_space_around_single_line_negative_space_gap.rs +++ b/tests/generated/flex/align_content_space_around_single_line_negative_space_gap.rs @@ -1,8 +1,8 @@ #[test] fn align_content_space_around_single_line_negative_space_gap() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { flex_shrink: 0f32, @@ -49,9 +49,9 @@ fn align_content_space_around_single_line_negative_space_gap() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); diff --git a/tests/generated/flex/align_content_space_around_wrapped.rs b/tests/generated/flex/align_content_space_around_wrapped.rs index d6f3029d8..36b60bf45 100644 --- a/tests/generated/flex/align_content_space_around_wrapped.rs +++ b/tests/generated/flex/align_content_space_around_wrapped.rs @@ -1,8 +1,8 @@ #[test] fn align_content_space_around_wrapped() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -71,9 +71,9 @@ fn align_content_space_around_wrapped() { &[node0, node1, node2, node3, node4, node5], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/align_content_space_around_wrapped_negative_space.rs b/tests/generated/flex/align_content_space_around_wrapped_negative_space.rs index 9080987c5..46d2c9883 100644 --- a/tests/generated/flex/align_content_space_around_wrapped_negative_space.rs +++ b/tests/generated/flex/align_content_space_around_wrapped_negative_space.rs @@ -1,8 +1,8 @@ #[test] fn align_content_space_around_wrapped_negative_space() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { flex_shrink: 0f32, @@ -66,9 +66,9 @@ fn align_content_space_around_wrapped_negative_space() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); diff --git a/tests/generated/flex/align_content_space_around_wrapped_negative_space_gap.rs b/tests/generated/flex/align_content_space_around_wrapped_negative_space_gap.rs index a9387dbbb..464f73913 100644 --- a/tests/generated/flex/align_content_space_around_wrapped_negative_space_gap.rs +++ b/tests/generated/flex/align_content_space_around_wrapped_negative_space_gap.rs @@ -1,8 +1,8 @@ #[test] fn align_content_space_around_wrapped_negative_space_gap() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { flex_shrink: 0f32, @@ -70,9 +70,9 @@ fn align_content_space_around_wrapped_negative_space_gap() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); diff --git a/tests/generated/flex/align_content_space_between_single_line.rs b/tests/generated/flex/align_content_space_between_single_line.rs index 05fa0bd12..3177f3851 100644 --- a/tests/generated/flex/align_content_space_between_single_line.rs +++ b/tests/generated/flex/align_content_space_between_single_line.rs @@ -1,8 +1,8 @@ #[test] fn align_content_space_between_single_line() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -70,9 +70,9 @@ fn align_content_space_between_single_line() { &[node0, node1, node2, node3, node4, node5], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/align_content_space_between_single_line_negative_space.rs b/tests/generated/flex/align_content_space_between_single_line_negative_space.rs index 437e947df..56dfcfede 100644 --- a/tests/generated/flex/align_content_space_between_single_line_negative_space.rs +++ b/tests/generated/flex/align_content_space_between_single_line_negative_space.rs @@ -1,8 +1,8 @@ #[test] fn align_content_space_between_single_line_negative_space() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { flex_shrink: 0f32, @@ -45,9 +45,9 @@ fn align_content_space_between_single_line_negative_space() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); diff --git a/tests/generated/flex/align_content_space_between_single_line_negative_space_gap.rs b/tests/generated/flex/align_content_space_between_single_line_negative_space_gap.rs index 5f4bad4f2..d093ed632 100644 --- a/tests/generated/flex/align_content_space_between_single_line_negative_space_gap.rs +++ b/tests/generated/flex/align_content_space_between_single_line_negative_space_gap.rs @@ -1,8 +1,8 @@ #[test] fn align_content_space_between_single_line_negative_space_gap() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { flex_shrink: 0f32, @@ -49,9 +49,9 @@ fn align_content_space_between_single_line_negative_space_gap() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); diff --git a/tests/generated/flex/align_content_space_between_wrapped.rs b/tests/generated/flex/align_content_space_between_wrapped.rs index eff556460..b827d9c81 100644 --- a/tests/generated/flex/align_content_space_between_wrapped.rs +++ b/tests/generated/flex/align_content_space_between_wrapped.rs @@ -1,8 +1,8 @@ #[test] fn align_content_space_between_wrapped() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -71,9 +71,9 @@ fn align_content_space_between_wrapped() { &[node0, node1, node2, node3, node4, node5], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/align_content_space_between_wrapped_negative_space.rs b/tests/generated/flex/align_content_space_between_wrapped_negative_space.rs index 781c15c6e..a06c132cc 100644 --- a/tests/generated/flex/align_content_space_between_wrapped_negative_space.rs +++ b/tests/generated/flex/align_content_space_between_wrapped_negative_space.rs @@ -1,8 +1,8 @@ #[test] fn align_content_space_between_wrapped_negative_space() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { flex_shrink: 0f32, @@ -66,9 +66,9 @@ fn align_content_space_between_wrapped_negative_space() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); diff --git a/tests/generated/flex/align_content_space_between_wrapped_negative_space_gap.rs b/tests/generated/flex/align_content_space_between_wrapped_negative_space_gap.rs index f72197fa0..333ce3992 100644 --- a/tests/generated/flex/align_content_space_between_wrapped_negative_space_gap.rs +++ b/tests/generated/flex/align_content_space_between_wrapped_negative_space_gap.rs @@ -1,8 +1,8 @@ #[test] fn align_content_space_between_wrapped_negative_space_gap() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { flex_shrink: 0f32, @@ -70,9 +70,9 @@ fn align_content_space_between_wrapped_negative_space_gap() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); diff --git a/tests/generated/flex/align_content_space_evenly_single_line.rs b/tests/generated/flex/align_content_space_evenly_single_line.rs index 9b547aeac..0dc9fb3a4 100644 --- a/tests/generated/flex/align_content_space_evenly_single_line.rs +++ b/tests/generated/flex/align_content_space_evenly_single_line.rs @@ -1,8 +1,8 @@ #[test] fn align_content_space_evenly_single_line() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -70,9 +70,9 @@ fn align_content_space_evenly_single_line() { &[node0, node1, node2, node3, node4, node5], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/align_content_space_evenly_single_line_negative_space.rs b/tests/generated/flex/align_content_space_evenly_single_line_negative_space.rs index 43a50179c..ad7d8a394 100644 --- a/tests/generated/flex/align_content_space_evenly_single_line_negative_space.rs +++ b/tests/generated/flex/align_content_space_evenly_single_line_negative_space.rs @@ -1,8 +1,8 @@ #[test] fn align_content_space_evenly_single_line_negative_space() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { flex_shrink: 0f32, @@ -45,9 +45,9 @@ fn align_content_space_evenly_single_line_negative_space() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); diff --git a/tests/generated/flex/align_content_space_evenly_single_line_negative_space_gap.rs b/tests/generated/flex/align_content_space_evenly_single_line_negative_space_gap.rs index 0076d2058..fcefcbe74 100644 --- a/tests/generated/flex/align_content_space_evenly_single_line_negative_space_gap.rs +++ b/tests/generated/flex/align_content_space_evenly_single_line_negative_space_gap.rs @@ -1,8 +1,8 @@ #[test] fn align_content_space_evenly_single_line_negative_space_gap() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { flex_shrink: 0f32, @@ -49,9 +49,9 @@ fn align_content_space_evenly_single_line_negative_space_gap() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); diff --git a/tests/generated/flex/align_content_space_evenly_wrapped.rs b/tests/generated/flex/align_content_space_evenly_wrapped.rs index 93516d9aa..3404f526f 100644 --- a/tests/generated/flex/align_content_space_evenly_wrapped.rs +++ b/tests/generated/flex/align_content_space_evenly_wrapped.rs @@ -1,8 +1,8 @@ #[test] fn align_content_space_evenly_wrapped() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -71,9 +71,9 @@ fn align_content_space_evenly_wrapped() { &[node0, node1, node2, node3, node4, node5], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/align_content_space_evenly_wrapped_negative_space.rs b/tests/generated/flex/align_content_space_evenly_wrapped_negative_space.rs index d24ec0843..77cff6772 100644 --- a/tests/generated/flex/align_content_space_evenly_wrapped_negative_space.rs +++ b/tests/generated/flex/align_content_space_evenly_wrapped_negative_space.rs @@ -1,8 +1,8 @@ #[test] fn align_content_space_evenly_wrapped_negative_space() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { flex_shrink: 0f32, @@ -66,9 +66,9 @@ fn align_content_space_evenly_wrapped_negative_space() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); diff --git a/tests/generated/flex/align_content_space_evenly_wrapped_negative_space_gap.rs b/tests/generated/flex/align_content_space_evenly_wrapped_negative_space_gap.rs index 0d01fd6db..631798168 100644 --- a/tests/generated/flex/align_content_space_evenly_wrapped_negative_space_gap.rs +++ b/tests/generated/flex/align_content_space_evenly_wrapped_negative_space_gap.rs @@ -1,8 +1,8 @@ #[test] fn align_content_space_evenly_wrapped_negative_space_gap() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { flex_shrink: 0f32, @@ -70,9 +70,9 @@ fn align_content_space_evenly_wrapped_negative_space_gap() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); diff --git a/tests/generated/flex/align_content_spacearound.rs b/tests/generated/flex/align_content_spacearound.rs index 5f14f2b5a..f6a8843df 100644 --- a/tests/generated/flex/align_content_spacearound.rs +++ b/tests/generated/flex/align_content_spacearound.rs @@ -1,8 +1,8 @@ #[test] fn align_content_spacearound() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -62,9 +62,9 @@ fn align_content_spacearound() { &[node0, node1, node2, node3, node4], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 140f32, "width of node {:?}. Expected {}. Actual {}", node, 140f32, size.width); diff --git a/tests/generated/flex/align_content_spacebetween.rs b/tests/generated/flex/align_content_spacebetween.rs index 17e7e3018..ae182f0bc 100644 --- a/tests/generated/flex/align_content_spacebetween.rs +++ b/tests/generated/flex/align_content_spacebetween.rs @@ -1,8 +1,8 @@ #[test] fn align_content_spacebetween() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -62,9 +62,9 @@ fn align_content_spacebetween() { &[node0, node1, node2, node3, node4], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 130f32, "width of node {:?}. Expected {}. Actual {}", node, 130f32, size.width); diff --git a/tests/generated/flex/align_content_start.rs b/tests/generated/flex/align_content_start.rs index 29953788b..59adc810b 100644 --- a/tests/generated/flex/align_content_start.rs +++ b/tests/generated/flex/align_content_start.rs @@ -1,8 +1,8 @@ #[test] fn align_content_start() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -62,9 +62,9 @@ fn align_content_start() { &[node0, node1, node2, node3, node4], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 130f32, "width of node {:?}. Expected {}. Actual {}", node, 130f32, size.width); diff --git a/tests/generated/flex/align_content_start_single_line_negative_space.rs b/tests/generated/flex/align_content_start_single_line_negative_space.rs index 90b645b09..bb0be17eb 100644 --- a/tests/generated/flex/align_content_start_single_line_negative_space.rs +++ b/tests/generated/flex/align_content_start_single_line_negative_space.rs @@ -1,8 +1,8 @@ #[test] fn align_content_start_single_line_negative_space() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { flex_shrink: 0f32, @@ -45,9 +45,9 @@ fn align_content_start_single_line_negative_space() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); diff --git a/tests/generated/flex/align_content_start_single_line_negative_space_gap.rs b/tests/generated/flex/align_content_start_single_line_negative_space_gap.rs index 95b6176de..934c10a04 100644 --- a/tests/generated/flex/align_content_start_single_line_negative_space_gap.rs +++ b/tests/generated/flex/align_content_start_single_line_negative_space_gap.rs @@ -1,8 +1,8 @@ #[test] fn align_content_start_single_line_negative_space_gap() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { flex_shrink: 0f32, @@ -49,9 +49,9 @@ fn align_content_start_single_line_negative_space_gap() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); diff --git a/tests/generated/flex/align_content_start_wrapped_negative_space.rs b/tests/generated/flex/align_content_start_wrapped_negative_space.rs index 5a23c6e34..b65b846ee 100644 --- a/tests/generated/flex/align_content_start_wrapped_negative_space.rs +++ b/tests/generated/flex/align_content_start_wrapped_negative_space.rs @@ -1,8 +1,8 @@ #[test] fn align_content_start_wrapped_negative_space() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { flex_shrink: 0f32, @@ -66,9 +66,9 @@ fn align_content_start_wrapped_negative_space() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); diff --git a/tests/generated/flex/align_content_stretch.rs b/tests/generated/flex/align_content_stretch.rs index d00bebce8..248979a44 100644 --- a/tests/generated/flex/align_content_stretch.rs +++ b/tests/generated/flex/align_content_stretch.rs @@ -1,8 +1,8 @@ #[test] fn align_content_stretch() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Length(50f32), height: auto() }, @@ -48,9 +48,9 @@ fn align_content_stretch() { &[node0, node1, node2, node3, node4], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 150f32, "width of node {:?}. Expected {}. Actual {}", node, 150f32, size.width); diff --git a/tests/generated/flex/align_content_stretch_column.rs b/tests/generated/flex/align_content_stretch_column.rs index b71d61da9..667653c35 100644 --- a/tests/generated/flex/align_content_stretch_column.rs +++ b/tests/generated/flex/align_content_stretch_column.rs @@ -1,8 +1,8 @@ #[test] fn align_content_stretch_column() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { flex_grow: 1f32, @@ -63,9 +63,9 @@ fn align_content_stretch_column() { &[node0, node1, node2, node3, node4], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/align_content_stretch_is_not_overriding_align_items.rs b/tests/generated/flex/align_content_stretch_is_not_overriding_align_items.rs index 086869506..b4212c792 100644 --- a/tests/generated/flex/align_content_stretch_is_not_overriding_align_items.rs +++ b/tests/generated/flex/align_content_stretch_is_not_overriding_align_items.rs @@ -1,8 +1,8 @@ #[test] fn align_content_stretch_is_not_overriding_align_items() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { align_content: Some(taffy::style::AlignContent::Stretch), @@ -33,9 +33,9 @@ fn align_content_stretch_is_not_overriding_align_items() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/align_content_stretch_row.rs b/tests/generated/flex/align_content_stretch_row.rs index eb57bd93a..4aa0e286f 100644 --- a/tests/generated/flex/align_content_stretch_row.rs +++ b/tests/generated/flex/align_content_stretch_row.rs @@ -1,8 +1,8 @@ #[test] fn align_content_stretch_row() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Length(50f32), height: auto() }, @@ -47,9 +47,9 @@ fn align_content_stretch_row() { &[node0, node1, node2, node3, node4], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 150f32, "width of node {:?}. Expected {}. Actual {}", node, 150f32, size.width); diff --git a/tests/generated/flex/align_content_stretch_row_with_children.rs b/tests/generated/flex/align_content_stretch_row_with_children.rs index 4d7ce8b78..12990849b 100644 --- a/tests/generated/flex/align_content_stretch_row_with_children.rs +++ b/tests/generated/flex/align_content_stretch_row_with_children.rs @@ -1,8 +1,8 @@ #[test] fn align_content_stretch_row_with_children() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { flex_grow: 1f32, @@ -59,9 +59,9 @@ fn align_content_stretch_row_with_children() { &[node0, node1, node2, node3, node4], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 150f32, "width of node {:?}. Expected {}. Actual {}", node, 150f32, size.width); diff --git a/tests/generated/flex/align_content_stretch_row_with_fixed_height.rs b/tests/generated/flex/align_content_stretch_row_with_fixed_height.rs index 18c35e35d..fd38e3f6f 100644 --- a/tests/generated/flex/align_content_stretch_row_with_fixed_height.rs +++ b/tests/generated/flex/align_content_stretch_row_with_fixed_height.rs @@ -1,8 +1,8 @@ #[test] fn align_content_stretch_row_with_fixed_height() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Length(50f32), height: auto() }, @@ -50,9 +50,9 @@ fn align_content_stretch_row_with_fixed_height() { &[node0, node1, node2, node3, node4], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 150f32, "width of node {:?}. Expected {}. Actual {}", node, 150f32, size.width); diff --git a/tests/generated/flex/align_content_stretch_row_with_flex.rs b/tests/generated/flex/align_content_stretch_row_with_flex.rs index b692d0717..114eddc8b 100644 --- a/tests/generated/flex/align_content_stretch_row_with_flex.rs +++ b/tests/generated/flex/align_content_stretch_row_with_flex.rs @@ -1,8 +1,8 @@ #[test] fn align_content_stretch_row_with_flex() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Length(50f32), height: auto() }, @@ -53,9 +53,9 @@ fn align_content_stretch_row_with_flex() { &[node0, node1, node2, node3, node4], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 150f32, "width of node {:?}. Expected {}. Actual {}", node, 150f32, size.width); diff --git a/tests/generated/flex/align_content_stretch_row_with_flex_no_shrink.rs b/tests/generated/flex/align_content_stretch_row_with_flex_no_shrink.rs index 1b67d19fd..daa1b34bf 100644 --- a/tests/generated/flex/align_content_stretch_row_with_flex_no_shrink.rs +++ b/tests/generated/flex/align_content_stretch_row_with_flex_no_shrink.rs @@ -1,8 +1,8 @@ #[test] fn align_content_stretch_row_with_flex_no_shrink() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Length(50f32), height: auto() }, @@ -53,9 +53,9 @@ fn align_content_stretch_row_with_flex_no_shrink() { &[node0, node1, node2, node3, node4], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 150f32, "width of node {:?}. Expected {}. Actual {}", node, 150f32, size.width); diff --git a/tests/generated/flex/align_content_stretch_row_with_margin.rs b/tests/generated/flex/align_content_stretch_row_with_margin.rs index fbd7f080d..1cf0e9593 100644 --- a/tests/generated/flex/align_content_stretch_row_with_margin.rs +++ b/tests/generated/flex/align_content_stretch_row_with_margin.rs @@ -1,8 +1,8 @@ #[test] fn align_content_stretch_row_with_margin() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Length(50f32), height: auto() }, @@ -59,9 +59,9 @@ fn align_content_stretch_row_with_margin() { &[node0, node1, node2, node3, node4], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 150f32, "width of node {:?}. Expected {}. Actual {}", node, 150f32, size.width); diff --git a/tests/generated/flex/align_content_stretch_row_with_max_height.rs b/tests/generated/flex/align_content_stretch_row_with_max_height.rs index f9f0366c3..1f2d8e334 100644 --- a/tests/generated/flex/align_content_stretch_row_with_max_height.rs +++ b/tests/generated/flex/align_content_stretch_row_with_max_height.rs @@ -1,8 +1,8 @@ #[test] fn align_content_stretch_row_with_max_height() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Length(50f32), height: auto() }, @@ -48,9 +48,9 @@ fn align_content_stretch_row_with_max_height() { &[node0, node1, node2, node3, node4], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 150f32, "width of node {:?}. Expected {}. Actual {}", node, 150f32, size.width); diff --git a/tests/generated/flex/align_content_stretch_row_with_min_height.rs b/tests/generated/flex/align_content_stretch_row_with_min_height.rs index bd7505acc..c60be752a 100644 --- a/tests/generated/flex/align_content_stretch_row_with_min_height.rs +++ b/tests/generated/flex/align_content_stretch_row_with_min_height.rs @@ -1,8 +1,8 @@ #[test] fn align_content_stretch_row_with_min_height() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Length(50f32), height: auto() }, @@ -48,9 +48,9 @@ fn align_content_stretch_row_with_min_height() { &[node0, node1, node2, node3, node4], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 150f32, "width of node {:?}. Expected {}. Actual {}", node, 150f32, size.width); diff --git a/tests/generated/flex/align_content_stretch_row_with_padding.rs b/tests/generated/flex/align_content_stretch_row_with_padding.rs index a97f796aa..69a802415 100644 --- a/tests/generated/flex/align_content_stretch_row_with_padding.rs +++ b/tests/generated/flex/align_content_stretch_row_with_padding.rs @@ -1,8 +1,8 @@ #[test] fn align_content_stretch_row_with_padding() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Length(50f32), height: auto() }, @@ -59,9 +59,9 @@ fn align_content_stretch_row_with_padding() { &[node0, node1, node2, node3, node4], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 150f32, "width of node {:?}. Expected {}. Actual {}", node, 150f32, size.width); diff --git a/tests/generated/flex/align_content_stretch_row_with_single_row.rs b/tests/generated/flex/align_content_stretch_row_with_single_row.rs index 0f0fd261d..7b7233162 100644 --- a/tests/generated/flex/align_content_stretch_row_with_single_row.rs +++ b/tests/generated/flex/align_content_stretch_row_with_single_row.rs @@ -1,8 +1,8 @@ #[test] fn align_content_stretch_row_with_single_row() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Length(50f32), height: auto() }, @@ -29,9 +29,9 @@ fn align_content_stretch_row_with_single_row() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 150f32, "width of node {:?}. Expected {}. Actual {}", node, 150f32, size.width); diff --git a/tests/generated/flex/align_flex_start_with_shrinking_children.rs b/tests/generated/flex/align_flex_start_with_shrinking_children.rs index 65cf55d8f..241c237e5 100644 --- a/tests/generated/flex/align_flex_start_with_shrinking_children.rs +++ b/tests/generated/flex/align_flex_start_with_shrinking_children.rs @@ -1,8 +1,8 @@ #[test] fn align_flex_start_with_shrinking_children() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node000 = taffy.new_leaf(taffy::style::Style { flex_grow: 1f32, flex_shrink: 1f32, ..Default::default() }).unwrap(); let node00 = taffy @@ -26,9 +26,9 @@ fn align_flex_start_with_shrinking_children() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 500f32, "width of node {:?}. Expected {}. Actual {}", node, 500f32, size.width); diff --git a/tests/generated/flex/align_flex_start_with_shrinking_children_with_stretch.rs b/tests/generated/flex/align_flex_start_with_shrinking_children_with_stretch.rs index 244989757..b731e544e 100644 --- a/tests/generated/flex/align_flex_start_with_shrinking_children_with_stretch.rs +++ b/tests/generated/flex/align_flex_start_with_shrinking_children_with_stretch.rs @@ -1,8 +1,8 @@ #[test] fn align_flex_start_with_shrinking_children_with_stretch() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node000 = taffy.new_leaf(taffy::style::Style { flex_grow: 1f32, flex_shrink: 1f32, ..Default::default() }).unwrap(); let node00 = taffy @@ -34,9 +34,9 @@ fn align_flex_start_with_shrinking_children_with_stretch() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 500f32, "width of node {:?}. Expected {}. Actual {}", node, 500f32, size.width); diff --git a/tests/generated/flex/align_flex_start_with_stretching_children.rs b/tests/generated/flex/align_flex_start_with_stretching_children.rs index b226615f8..8d271ef7d 100644 --- a/tests/generated/flex/align_flex_start_with_stretching_children.rs +++ b/tests/generated/flex/align_flex_start_with_stretching_children.rs @@ -1,8 +1,8 @@ #[test] fn align_flex_start_with_stretching_children() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node000 = taffy.new_leaf(taffy::style::Style { flex_grow: 1f32, flex_shrink: 1f32, ..Default::default() }).unwrap(); let node00 = taffy @@ -21,9 +21,9 @@ fn align_flex_start_with_stretching_children() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 500f32, "width of node {:?}. Expected {}. Actual {}", node, 500f32, size.width); diff --git a/tests/generated/flex/align_items_center.rs b/tests/generated/flex/align_items_center.rs index 0a84a7295..a33e4c871 100644 --- a/tests/generated/flex/align_items_center.rs +++ b/tests/generated/flex/align_items_center.rs @@ -1,8 +1,8 @@ #[test] fn align_items_center() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -25,9 +25,9 @@ fn align_items_center() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/align_items_center_child_with_margin_bigger_than_parent.rs b/tests/generated/flex/align_items_center_child_with_margin_bigger_than_parent.rs index 8872eecd8..192addd45 100644 --- a/tests/generated/flex/align_items_center_child_with_margin_bigger_than_parent.rs +++ b/tests/generated/flex/align_items_center_child_with_margin_bigger_than_parent.rs @@ -1,8 +1,8 @@ #[test] fn align_items_center_child_with_margin_bigger_than_parent() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -38,9 +38,9 @@ fn align_items_center_child_with_margin_bigger_than_parent() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/flex/align_items_center_child_without_margin_bigger_than_parent.rs b/tests/generated/flex/align_items_center_child_without_margin_bigger_than_parent.rs index 11b4e8653..24b0c828c 100644 --- a/tests/generated/flex/align_items_center_child_without_margin_bigger_than_parent.rs +++ b/tests/generated/flex/align_items_center_child_without_margin_bigger_than_parent.rs @@ -1,8 +1,8 @@ #[test] fn align_items_center_child_without_margin_bigger_than_parent() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -32,9 +32,9 @@ fn align_items_center_child_without_margin_bigger_than_parent() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/flex/align_items_center_justify_content_center.rs b/tests/generated/flex/align_items_center_justify_content_center.rs index 228b5b3eb..7aa001085 100644 --- a/tests/generated/flex/align_items_center_justify_content_center.rs +++ b/tests/generated/flex/align_items_center_justify_content_center.rs @@ -1,10 +1,10 @@ #[test] fn align_items_center_justify_content_center() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node000 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Length(10f32), @@ -12,16 +12,11 @@ fn align_items_center_justify_content_center() { }, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "\n "; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "\n ", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node00 = taffy @@ -67,9 +62,9 @@ fn align_items_center_justify_content_center() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 500f32, "width of node {:?}. Expected {}. Actual {}", node, 500f32, size.width); diff --git a/tests/generated/flex/align_items_center_min_max_with_padding.rs b/tests/generated/flex/align_items_center_min_max_with_padding.rs index 046bd66a3..e9de5e086 100644 --- a/tests/generated/flex/align_items_center_min_max_with_padding.rs +++ b/tests/generated/flex/align_items_center_min_max_with_padding.rs @@ -1,8 +1,8 @@ #[test] fn align_items_center_min_max_with_padding() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -35,9 +35,9 @@ fn align_items_center_min_max_with_padding() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); diff --git a/tests/generated/flex/align_items_center_with_child_margin.rs b/tests/generated/flex/align_items_center_with_child_margin.rs index d3d38be0d..bab827cd1 100644 --- a/tests/generated/flex/align_items_center_with_child_margin.rs +++ b/tests/generated/flex/align_items_center_with_child_margin.rs @@ -1,8 +1,8 @@ #[test] fn align_items_center_with_child_margin() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -31,9 +31,9 @@ fn align_items_center_with_child_margin() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/align_items_center_with_child_top.rs b/tests/generated/flex/align_items_center_with_child_top.rs index 089bbf625..ca1ec6672 100644 --- a/tests/generated/flex/align_items_center_with_child_top.rs +++ b/tests/generated/flex/align_items_center_with_child_top.rs @@ -1,8 +1,8 @@ #[test] fn align_items_center_with_child_top() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -31,9 +31,9 @@ fn align_items_center_with_child_top() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/align_items_flex_end.rs b/tests/generated/flex/align_items_flex_end.rs index 225793e96..4f7cec83d 100644 --- a/tests/generated/flex/align_items_flex_end.rs +++ b/tests/generated/flex/align_items_flex_end.rs @@ -1,8 +1,8 @@ #[test] fn align_items_flex_end() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -25,9 +25,9 @@ fn align_items_flex_end() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/align_items_flex_end_child_with_margin_bigger_than_parent.rs b/tests/generated/flex/align_items_flex_end_child_with_margin_bigger_than_parent.rs index 66058782d..fa1195710 100644 --- a/tests/generated/flex/align_items_flex_end_child_with_margin_bigger_than_parent.rs +++ b/tests/generated/flex/align_items_flex_end_child_with_margin_bigger_than_parent.rs @@ -1,8 +1,8 @@ #[test] fn align_items_flex_end_child_with_margin_bigger_than_parent() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -38,9 +38,9 @@ fn align_items_flex_end_child_with_margin_bigger_than_parent() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/flex/align_items_flex_end_child_without_margin_bigger_than_parent.rs b/tests/generated/flex/align_items_flex_end_child_without_margin_bigger_than_parent.rs index dfcbfff5b..413ecaa39 100644 --- a/tests/generated/flex/align_items_flex_end_child_without_margin_bigger_than_parent.rs +++ b/tests/generated/flex/align_items_flex_end_child_without_margin_bigger_than_parent.rs @@ -1,8 +1,8 @@ #[test] fn align_items_flex_end_child_without_margin_bigger_than_parent() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -32,9 +32,9 @@ fn align_items_flex_end_child_without_margin_bigger_than_parent() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/flex/align_items_flex_start.rs b/tests/generated/flex/align_items_flex_start.rs index c37316871..f74019d26 100644 --- a/tests/generated/flex/align_items_flex_start.rs +++ b/tests/generated/flex/align_items_flex_start.rs @@ -1,8 +1,8 @@ #[test] fn align_items_flex_start() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -25,9 +25,9 @@ fn align_items_flex_start() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/align_items_min_max.rs b/tests/generated/flex/align_items_min_max.rs index c40123e94..8e755cb7e 100644 --- a/tests/generated/flex/align_items_min_max.rs +++ b/tests/generated/flex/align_items_min_max.rs @@ -1,8 +1,8 @@ #[test] fn align_items_min_max() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -25,9 +25,9 @@ fn align_items_min_max() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/align_items_stretch.rs b/tests/generated/flex/align_items_stretch.rs index a2790385c..34acd2302 100644 --- a/tests/generated/flex/align_items_stretch.rs +++ b/tests/generated/flex/align_items_stretch.rs @@ -1,8 +1,8 @@ #[test] fn align_items_stretch() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Length(10f32), height: auto() }, @@ -21,9 +21,9 @@ fn align_items_stretch() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/align_items_stretch_min_cross.rs b/tests/generated/flex/align_items_stretch_min_cross.rs index 8d472005d..d44027064 100644 --- a/tests/generated/flex/align_items_stretch_min_cross.rs +++ b/tests/generated/flex/align_items_stretch_min_cross.rs @@ -1,8 +1,8 @@ #[test] fn align_items_stretch_min_cross() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_shrink: 0f32, @@ -23,9 +23,9 @@ fn align_items_stretch_min_cross() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); diff --git a/tests/generated/flex/align_self_baseline.rs b/tests/generated/flex/align_self_baseline.rs index 8baca98aa..6f1a03cd6 100644 --- a/tests/generated/flex/align_self_baseline.rs +++ b/tests/generated/flex/align_self_baseline.rs @@ -1,8 +1,8 @@ #[test] fn align_self_baseline() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { align_self: Some(taffy::style::AlignSelf::Baseline), @@ -47,9 +47,9 @@ fn align_self_baseline() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/align_self_center.rs b/tests/generated/flex/align_self_center.rs index 9054d4a56..3f0b36fc0 100644 --- a/tests/generated/flex/align_self_center.rs +++ b/tests/generated/flex/align_self_center.rs @@ -1,8 +1,8 @@ #[test] fn align_self_center() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { align_self: Some(taffy::style::AlignSelf::Center), @@ -25,9 +25,9 @@ fn align_self_center() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/align_self_center_undefined_max_height.rs b/tests/generated/flex/align_self_center_undefined_max_height.rs index 89862fbcd..df4dc887f 100644 --- a/tests/generated/flex/align_self_center_undefined_max_height.rs +++ b/tests/generated/flex/align_self_center_undefined_max_height.rs @@ -1,8 +1,8 @@ #[test] fn align_self_center_undefined_max_height() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -32,9 +32,9 @@ fn align_self_center_undefined_max_height() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 280f32, "width of node {:?}. Expected {}. Actual {}", node, 280f32, size.width); diff --git a/tests/generated/flex/align_self_flex_end.rs b/tests/generated/flex/align_self_flex_end.rs index 52073864a..9aedb2a27 100644 --- a/tests/generated/flex/align_self_flex_end.rs +++ b/tests/generated/flex/align_self_flex_end.rs @@ -1,8 +1,8 @@ #[test] fn align_self_flex_end() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { align_self: Some(taffy::style::AlignSelf::FlexEnd), @@ -25,9 +25,9 @@ fn align_self_flex_end() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/align_self_flex_end_override_flex_start.rs b/tests/generated/flex/align_self_flex_end_override_flex_start.rs index e0c0dce38..a5e5318ef 100644 --- a/tests/generated/flex/align_self_flex_end_override_flex_start.rs +++ b/tests/generated/flex/align_self_flex_end_override_flex_start.rs @@ -1,8 +1,8 @@ #[test] fn align_self_flex_end_override_flex_start() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { align_self: Some(taffy::style::AlignSelf::FlexEnd), @@ -26,9 +26,9 @@ fn align_self_flex_end_override_flex_start() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/align_self_flex_start.rs b/tests/generated/flex/align_self_flex_start.rs index decaad02d..9a91e31bc 100644 --- a/tests/generated/flex/align_self_flex_start.rs +++ b/tests/generated/flex/align_self_flex_start.rs @@ -1,8 +1,8 @@ #[test] fn align_self_flex_start() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { align_self: Some(taffy::style::AlignSelf::FlexStart), @@ -25,9 +25,9 @@ fn align_self_flex_start() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/align_stretch_should_size_based_on_parent.rs b/tests/generated/flex/align_stretch_should_size_based_on_parent.rs index 3a101ee02..8f24ede86 100644 --- a/tests/generated/flex/align_stretch_should_size_based_on_parent.rs +++ b/tests/generated/flex/align_stretch_should_size_based_on_parent.rs @@ -1,8 +1,8 @@ #[test] fn align_stretch_should_size_based_on_parent() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node000 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -38,9 +38,9 @@ fn align_stretch_should_size_based_on_parent() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/android_news_feed.rs b/tests/generated/flex/android_news_feed.rs index edbb5c7fe..8f4fef252 100644 --- a/tests/generated/flex/android_news_feed.rs +++ b/tests/generated/flex/android_news_feed.rs @@ -1,8 +1,8 @@ #[test] fn android_news_feed() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node000000 = taffy .new_leaf(taffy::style::Style { align_content: Some(taffy::style::AlignContent::Stretch), @@ -203,9 +203,9 @@ fn android_news_feed() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 1080f32, "width of node {:?}. Expected {}. Actual {}", node, 1080f32, size.width); diff --git a/tests/generated/flex/aspect_ratio_flex_column_fill_height.rs b/tests/generated/flex/aspect_ratio_flex_column_fill_height.rs index 843969ba9..82c2276bb 100644 --- a/tests/generated/flex/aspect_ratio_flex_column_fill_height.rs +++ b/tests/generated/flex/aspect_ratio_flex_column_fill_height.rs @@ -1,8 +1,8 @@ #[test] fn aspect_ratio_flex_column_fill_height() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Length(40f32), height: auto() }, @@ -25,9 +25,9 @@ fn aspect_ratio_flex_column_fill_height() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/aspect_ratio_flex_column_fill_max_height.rs b/tests/generated/flex/aspect_ratio_flex_column_fill_max_height.rs index ef19f3ceb..9fbb5f2b1 100644 --- a/tests/generated/flex/aspect_ratio_flex_column_fill_max_height.rs +++ b/tests/generated/flex/aspect_ratio_flex_column_fill_max_height.rs @@ -1,9 +1,9 @@ #[test] fn aspect_ratio_flex_column_fill_max_height() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); - let node0 = taffy . new_leaf_with_measure (taffy :: style :: Style { max_size : taffy :: geometry :: Size { width : taffy :: style :: Dimension :: Length (40f32) , height : auto () , } , aspect_ratio : Some (2f32) , .. Default :: default () } , taffy :: tree :: MeasureFunc :: Raw (| known_dimensions , available_space | { const TEXT : & str = "HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH" ; crate :: measure_standard_text (known_dimensions , available_space , TEXT , crate :: WritingMode :: Horizontal , Some (2f32)) }) ,) . unwrap () ; + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); + let node0 = taffy . new_leaf_with_context (taffy :: style :: Style { max_size : taffy :: geometry :: Size { width : taffy :: style :: Dimension :: Length (40f32) , height : auto () , } , aspect_ratio : Some (2f32) , .. Default :: default () } , crate :: TextMeasure { text_content : "HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH" , writing_mode : crate :: WritingMode :: Horizontal , _aspect_ratio : Some (2f32) , } ,) . unwrap () ; let node = taffy .new_with_children( taffy::style::Style { @@ -19,9 +19,9 @@ fn aspect_ratio_flex_column_fill_max_height() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/aspect_ratio_flex_column_fill_max_width.rs b/tests/generated/flex/aspect_ratio_flex_column_fill_max_width.rs index 275b15e0d..6553e4222 100644 --- a/tests/generated/flex/aspect_ratio_flex_column_fill_max_width.rs +++ b/tests/generated/flex/aspect_ratio_flex_column_fill_max_width.rs @@ -1,25 +1,20 @@ #[test] fn aspect_ratio_flex_column_fill_max_width() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(20f32) }, aspect_ratio: Some(2f32), ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH\u{200b}HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - Some(2f32), - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH\u{200b}HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: Some(2f32), + }, ) .unwrap(); let node = taffy @@ -37,9 +32,9 @@ fn aspect_ratio_flex_column_fill_max_width() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/aspect_ratio_flex_column_fill_min_height.rs b/tests/generated/flex/aspect_ratio_flex_column_fill_min_height.rs index 6e70a2ff1..3ab77e5c0 100644 --- a/tests/generated/flex/aspect_ratio_flex_column_fill_min_height.rs +++ b/tests/generated/flex/aspect_ratio_flex_column_fill_min_height.rs @@ -1,8 +1,8 @@ #[test] fn aspect_ratio_flex_column_fill_min_height() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { min_size: taffy::geometry::Size { width: taffy::style::Dimension::Length(40f32), height: auto() }, @@ -25,9 +25,9 @@ fn aspect_ratio_flex_column_fill_min_height() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/aspect_ratio_flex_column_fill_min_width.rs b/tests/generated/flex/aspect_ratio_flex_column_fill_min_width.rs index 562262a7e..3a7acb8f5 100644 --- a/tests/generated/flex/aspect_ratio_flex_column_fill_min_width.rs +++ b/tests/generated/flex/aspect_ratio_flex_column_fill_min_width.rs @@ -1,25 +1,20 @@ #[test] fn aspect_ratio_flex_column_fill_min_width() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(40f32) }, aspect_ratio: Some(2f32), ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "\n \n "; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - Some(2f32), - ) - }), + crate::TextMeasure { + text_content: "\n \n ", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: Some(2f32), + }, ) .unwrap(); let node = taffy @@ -37,9 +32,9 @@ fn aspect_ratio_flex_column_fill_min_width() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/aspect_ratio_flex_column_fill_width.rs b/tests/generated/flex/aspect_ratio_flex_column_fill_width.rs index 0fd3c694f..bb8dab1dc 100644 --- a/tests/generated/flex/aspect_ratio_flex_column_fill_width.rs +++ b/tests/generated/flex/aspect_ratio_flex_column_fill_width.rs @@ -1,8 +1,8 @@ #[test] fn aspect_ratio_flex_column_fill_width() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(40f32) }, @@ -25,9 +25,9 @@ fn aspect_ratio_flex_column_fill_width() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/aspect_ratio_flex_column_fill_width_flex.rs b/tests/generated/flex/aspect_ratio_flex_column_fill_width_flex.rs index b91001e0e..542d71b85 100644 --- a/tests/generated/flex/aspect_ratio_flex_column_fill_width_flex.rs +++ b/tests/generated/flex/aspect_ratio_flex_column_fill_width_flex.rs @@ -1,8 +1,8 @@ #[test] fn aspect_ratio_flex_column_fill_width_flex() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(50f32) }, @@ -24,9 +24,9 @@ fn aspect_ratio_flex_column_fill_width_flex() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/aspect_ratio_flex_column_stretch_fill_height.rs b/tests/generated/flex/aspect_ratio_flex_column_stretch_fill_height.rs index 21adbd2db..ea20e5c28 100644 --- a/tests/generated/flex/aspect_ratio_flex_column_stretch_fill_height.rs +++ b/tests/generated/flex/aspect_ratio_flex_column_stretch_fill_height.rs @@ -1,8 +1,8 @@ #[test] fn aspect_ratio_flex_column_stretch_fill_height() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Length(40f32), height: auto() }, @@ -24,9 +24,9 @@ fn aspect_ratio_flex_column_stretch_fill_height() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/aspect_ratio_flex_column_stretch_fill_max_height.rs b/tests/generated/flex/aspect_ratio_flex_column_stretch_fill_max_height.rs index ca61ef0e5..d98349a23 100644 --- a/tests/generated/flex/aspect_ratio_flex_column_stretch_fill_max_height.rs +++ b/tests/generated/flex/aspect_ratio_flex_column_stretch_fill_max_height.rs @@ -1,9 +1,9 @@ #[test] fn aspect_ratio_flex_column_stretch_fill_max_height() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); - let node0 = taffy . new_leaf_with_measure (taffy :: style :: Style { max_size : taffy :: geometry :: Size { width : taffy :: style :: Dimension :: Length (40f32) , height : auto () , } , aspect_ratio : Some (2f32) , .. Default :: default () } , taffy :: tree :: MeasureFunc :: Raw (| known_dimensions , available_space | { const TEXT : & str = "HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH" ; crate :: measure_standard_text (known_dimensions , available_space , TEXT , crate :: WritingMode :: Horizontal , Some (2f32)) }) ,) . unwrap () ; + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); + let node0 = taffy . new_leaf_with_context (taffy :: style :: Style { max_size : taffy :: geometry :: Size { width : taffy :: style :: Dimension :: Length (40f32) , height : auto () , } , aspect_ratio : Some (2f32) , .. Default :: default () } , crate :: TextMeasure { text_content : "HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH" , writing_mode : crate :: WritingMode :: Horizontal , _aspect_ratio : Some (2f32) , } ,) . unwrap () ; let node = taffy .new_with_children( taffy::style::Style { @@ -18,9 +18,9 @@ fn aspect_ratio_flex_column_stretch_fill_max_height() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/aspect_ratio_flex_column_stretch_fill_max_width.rs b/tests/generated/flex/aspect_ratio_flex_column_stretch_fill_max_width.rs index 306601183..d6744cf82 100644 --- a/tests/generated/flex/aspect_ratio_flex_column_stretch_fill_max_width.rs +++ b/tests/generated/flex/aspect_ratio_flex_column_stretch_fill_max_width.rs @@ -1,25 +1,20 @@ #[test] fn aspect_ratio_flex_column_stretch_fill_max_width() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(20f32) }, aspect_ratio: Some(2f32), ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH\u{200b}HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - Some(2f32), - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH\u{200b}HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: Some(2f32), + }, ) .unwrap(); let node = taffy @@ -36,9 +31,9 @@ fn aspect_ratio_flex_column_stretch_fill_max_width() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/aspect_ratio_flex_column_stretch_fill_width.rs b/tests/generated/flex/aspect_ratio_flex_column_stretch_fill_width.rs index 91dd1352a..9bff0c43c 100644 --- a/tests/generated/flex/aspect_ratio_flex_column_stretch_fill_width.rs +++ b/tests/generated/flex/aspect_ratio_flex_column_stretch_fill_width.rs @@ -1,8 +1,8 @@ #[test] fn aspect_ratio_flex_column_stretch_fill_width() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(40f32) }, @@ -24,9 +24,9 @@ fn aspect_ratio_flex_column_stretch_fill_width() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/aspect_ratio_flex_row_fill_height.rs b/tests/generated/flex/aspect_ratio_flex_row_fill_height.rs index 69e74ab20..2d0be4d56 100644 --- a/tests/generated/flex/aspect_ratio_flex_row_fill_height.rs +++ b/tests/generated/flex/aspect_ratio_flex_row_fill_height.rs @@ -1,8 +1,8 @@ #[test] fn aspect_ratio_flex_row_fill_height() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Length(40f32), height: auto() }, @@ -24,9 +24,9 @@ fn aspect_ratio_flex_row_fill_height() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/aspect_ratio_flex_row_fill_max_height.rs b/tests/generated/flex/aspect_ratio_flex_row_fill_max_height.rs index 2f4674a44..e864a7cd1 100644 --- a/tests/generated/flex/aspect_ratio_flex_row_fill_max_height.rs +++ b/tests/generated/flex/aspect_ratio_flex_row_fill_max_height.rs @@ -1,9 +1,9 @@ #[test] fn aspect_ratio_flex_row_fill_max_height() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); - let node0 = taffy . new_leaf_with_measure (taffy :: style :: Style { max_size : taffy :: geometry :: Size { width : taffy :: style :: Dimension :: Length (40f32) , height : auto () , } , aspect_ratio : Some (2f32) , .. Default :: default () } , taffy :: tree :: MeasureFunc :: Raw (| known_dimensions , available_space | { const TEXT : & str = "HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH" ; crate :: measure_standard_text (known_dimensions , available_space , TEXT , crate :: WritingMode :: Horizontal , Some (2f32)) }) ,) . unwrap () ; + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); + let node0 = taffy . new_leaf_with_context (taffy :: style :: Style { max_size : taffy :: geometry :: Size { width : taffy :: style :: Dimension :: Length (40f32) , height : auto () , } , aspect_ratio : Some (2f32) , .. Default :: default () } , crate :: TextMeasure { text_content : "HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH" , writing_mode : crate :: WritingMode :: Horizontal , _aspect_ratio : Some (2f32) , } ,) . unwrap () ; let node = taffy .new_with_children( taffy::style::Style { @@ -18,9 +18,9 @@ fn aspect_ratio_flex_row_fill_max_height() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/aspect_ratio_flex_row_fill_max_width.rs b/tests/generated/flex/aspect_ratio_flex_row_fill_max_width.rs index d41cb38b8..10aacb128 100644 --- a/tests/generated/flex/aspect_ratio_flex_row_fill_max_width.rs +++ b/tests/generated/flex/aspect_ratio_flex_row_fill_max_width.rs @@ -1,25 +1,20 @@ #[test] fn aspect_ratio_flex_row_fill_max_width() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(20f32) }, aspect_ratio: Some(2f32), ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH\u{200b}HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - Some(2f32), - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH\u{200b}HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: Some(2f32), + }, ) .unwrap(); let node = taffy @@ -36,9 +31,9 @@ fn aspect_ratio_flex_row_fill_max_width() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/aspect_ratio_flex_row_fill_min_height.rs b/tests/generated/flex/aspect_ratio_flex_row_fill_min_height.rs index 75972828d..e82f7cbaa 100644 --- a/tests/generated/flex/aspect_ratio_flex_row_fill_min_height.rs +++ b/tests/generated/flex/aspect_ratio_flex_row_fill_min_height.rs @@ -1,8 +1,8 @@ #[test] fn aspect_ratio_flex_row_fill_min_height() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { min_size: taffy::geometry::Size { width: taffy::style::Dimension::Length(40f32), height: auto() }, @@ -24,9 +24,9 @@ fn aspect_ratio_flex_row_fill_min_height() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/aspect_ratio_flex_row_fill_min_width.rs b/tests/generated/flex/aspect_ratio_flex_row_fill_min_width.rs index e67f0e0af..621e8934d 100644 --- a/tests/generated/flex/aspect_ratio_flex_row_fill_min_width.rs +++ b/tests/generated/flex/aspect_ratio_flex_row_fill_min_width.rs @@ -1,25 +1,20 @@ #[test] fn aspect_ratio_flex_row_fill_min_width() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(40f32) }, aspect_ratio: Some(2f32), ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "\n \n "; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - Some(2f32), - ) - }), + crate::TextMeasure { + text_content: "\n \n ", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: Some(2f32), + }, ) .unwrap(); let node = taffy @@ -36,9 +31,9 @@ fn aspect_ratio_flex_row_fill_min_width() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/aspect_ratio_flex_row_fill_width.rs b/tests/generated/flex/aspect_ratio_flex_row_fill_width.rs index 4ee953c7f..47a97d295 100644 --- a/tests/generated/flex/aspect_ratio_flex_row_fill_width.rs +++ b/tests/generated/flex/aspect_ratio_flex_row_fill_width.rs @@ -1,8 +1,8 @@ #[test] fn aspect_ratio_flex_row_fill_width() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(40f32) }, @@ -24,9 +24,9 @@ fn aspect_ratio_flex_row_fill_width() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/aspect_ratio_flex_row_fill_width_flex.rs b/tests/generated/flex/aspect_ratio_flex_row_fill_width_flex.rs index b821fc3c2..af6ddb1b7 100644 --- a/tests/generated/flex/aspect_ratio_flex_row_fill_width_flex.rs +++ b/tests/generated/flex/aspect_ratio_flex_row_fill_width_flex.rs @@ -1,8 +1,8 @@ #[test] fn aspect_ratio_flex_row_fill_width_flex() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(50f32) }, @@ -24,9 +24,9 @@ fn aspect_ratio_flex_row_fill_width_flex() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/aspect_ratio_flex_row_stretch_fill_height.rs b/tests/generated/flex/aspect_ratio_flex_row_stretch_fill_height.rs index a8a30cfee..b1ff5db0d 100644 --- a/tests/generated/flex/aspect_ratio_flex_row_stretch_fill_height.rs +++ b/tests/generated/flex/aspect_ratio_flex_row_stretch_fill_height.rs @@ -1,8 +1,8 @@ #[test] fn aspect_ratio_flex_row_stretch_fill_height() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Length(40f32), height: auto() }, @@ -23,9 +23,9 @@ fn aspect_ratio_flex_row_stretch_fill_height() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/aspect_ratio_flex_row_stretch_fill_max_height.rs b/tests/generated/flex/aspect_ratio_flex_row_stretch_fill_max_height.rs index d6c528ecf..e11ffc987 100644 --- a/tests/generated/flex/aspect_ratio_flex_row_stretch_fill_max_height.rs +++ b/tests/generated/flex/aspect_ratio_flex_row_stretch_fill_max_height.rs @@ -1,9 +1,9 @@ #[test] fn aspect_ratio_flex_row_stretch_fill_max_height() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); - let node0 = taffy . new_leaf_with_measure (taffy :: style :: Style { max_size : taffy :: geometry :: Size { width : taffy :: style :: Dimension :: Length (40f32) , height : auto () , } , aspect_ratio : Some (2f32) , .. Default :: default () } , taffy :: tree :: MeasureFunc :: Raw (| known_dimensions , available_space | { const TEXT : & str = "HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH" ; crate :: measure_standard_text (known_dimensions , available_space , TEXT , crate :: WritingMode :: Horizontal , Some (2f32)) }) ,) . unwrap () ; + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); + let node0 = taffy . new_leaf_with_context (taffy :: style :: Style { max_size : taffy :: geometry :: Size { width : taffy :: style :: Dimension :: Length (40f32) , height : auto () , } , aspect_ratio : Some (2f32) , .. Default :: default () } , crate :: TextMeasure { text_content : "HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH" , writing_mode : crate :: WritingMode :: Horizontal , _aspect_ratio : Some (2f32) , } ,) . unwrap () ; let node = taffy .new_with_children( taffy::style::Style { @@ -17,9 +17,9 @@ fn aspect_ratio_flex_row_stretch_fill_max_height() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/aspect_ratio_flex_row_stretch_fill_max_width.rs b/tests/generated/flex/aspect_ratio_flex_row_stretch_fill_max_width.rs index f2ace8b03..44665b1eb 100644 --- a/tests/generated/flex/aspect_ratio_flex_row_stretch_fill_max_width.rs +++ b/tests/generated/flex/aspect_ratio_flex_row_stretch_fill_max_width.rs @@ -1,25 +1,20 @@ #[test] fn aspect_ratio_flex_row_stretch_fill_max_width() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(20f32) }, aspect_ratio: Some(2f32), ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH\u{200b}HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - Some(2f32), - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH\u{200b}HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: Some(2f32), + }, ) .unwrap(); let node = taffy @@ -35,9 +30,9 @@ fn aspect_ratio_flex_row_stretch_fill_max_width() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/aspect_ratio_flex_row_stretch_fill_width.rs b/tests/generated/flex/aspect_ratio_flex_row_stretch_fill_width.rs index 71c1db69f..96cdb7f88 100644 --- a/tests/generated/flex/aspect_ratio_flex_row_stretch_fill_width.rs +++ b/tests/generated/flex/aspect_ratio_flex_row_stretch_fill_width.rs @@ -1,8 +1,8 @@ #[test] fn aspect_ratio_flex_row_stretch_fill_width() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(40f32) }, @@ -23,9 +23,9 @@ fn aspect_ratio_flex_row_stretch_fill_width() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/bevy_issue_7976_3_level.rs b/tests/generated/flex/bevy_issue_7976_3_level.rs index 217d36066..e87ed368e 100644 --- a/tests/generated/flex/bevy_issue_7976_3_level.rs +++ b/tests/generated/flex/bevy_issue_7976_3_level.rs @@ -1,8 +1,8 @@ #[test] fn bevy_issue_7976_3_level() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -55,9 +55,9 @@ fn bevy_issue_7976_3_level() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/flex/bevy_issue_7976_4_level.rs b/tests/generated/flex/bevy_issue_7976_4_level.rs index 5affced4d..2cb388fda 100644 --- a/tests/generated/flex/bevy_issue_7976_4_level.rs +++ b/tests/generated/flex/bevy_issue_7976_4_level.rs @@ -1,8 +1,8 @@ #[test] fn bevy_issue_7976_4_level() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node000 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node00 = taffy .new_with_children( @@ -59,9 +59,9 @@ fn bevy_issue_7976_4_level() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/flex/bevy_issue_7976_reduced.rs b/tests/generated/flex/bevy_issue_7976_reduced.rs index 7b24108e1..84aff91e4 100644 --- a/tests/generated/flex/bevy_issue_7976_reduced.rs +++ b/tests/generated/flex/bevy_issue_7976_reduced.rs @@ -1,8 +1,8 @@ #[test] fn bevy_issue_7976_reduced() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Length(40f32), height: auto() }, @@ -19,9 +19,9 @@ fn bevy_issue_7976_reduced() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); diff --git a/tests/generated/flex/bevy_issue_8017.rs b/tests/generated/flex/bevy_issue_8017.rs index 641b73f63..51ff79828 100644 --- a/tests/generated/flex/bevy_issue_8017.rs +++ b/tests/generated/flex/bevy_issue_8017.rs @@ -1,8 +1,8 @@ #[test] fn bevy_issue_8017() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -97,9 +97,9 @@ fn bevy_issue_8017() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); diff --git a/tests/generated/flex/bevy_issue_8017_reduced.rs b/tests/generated/flex/bevy_issue_8017_reduced.rs index dea1c4e63..52c4f009b 100644 --- a/tests/generated/flex/bevy_issue_8017_reduced.rs +++ b/tests/generated/flex/bevy_issue_8017_reduced.rs @@ -1,8 +1,8 @@ #[test] fn bevy_issue_8017_reduced() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node0 = taffy .new_with_children( @@ -40,9 +40,9 @@ fn bevy_issue_8017_reduced() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/flex/bevy_issue_8082.rs b/tests/generated/flex/bevy_issue_8082.rs index 7ecf4b45e..6cd6ea1ac 100644 --- a/tests/generated/flex/bevy_issue_8082.rs +++ b/tests/generated/flex/bevy_issue_8082.rs @@ -1,8 +1,8 @@ #[test] fn bevy_issue_8082() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -91,9 +91,9 @@ fn bevy_issue_8082() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/flex/bevy_issue_8082_percent.rs b/tests/generated/flex/bevy_issue_8082_percent.rs index aec3d1107..7003d704d 100644 --- a/tests/generated/flex/bevy_issue_8082_percent.rs +++ b/tests/generated/flex/bevy_issue_8082_percent.rs @@ -1,8 +1,8 @@ #[test] fn bevy_issue_8082_percent() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -68,9 +68,9 @@ fn bevy_issue_8082_percent() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/flex/bevy_issue_9530.rs b/tests/generated/flex/bevy_issue_9530.rs index 6aef9590a..06b83e488 100644 --- a/tests/generated/flex/bevy_issue_9530.rs +++ b/tests/generated/flex/bevy_issue_9530.rs @@ -1,8 +1,8 @@ #[test] fn bevy_issue_9530() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, @@ -22,7 +22,7 @@ fn bevy_issue_9530() { ..Default::default() }) .unwrap(); - let node11 = taffy . new_leaf_with_measure (taffy :: style :: Style { align_items : Some (taffy :: style :: AlignItems :: Center) , align_content : Some (taffy :: style :: AlignContent :: Center) , justify_content : Some (taffy :: style :: JustifyContent :: Center) , flex_grow : 1f32 , margin : taffy :: geometry :: Rect { left : taffy :: style :: LengthPercentageAuto :: Length (20f32) , right : taffy :: style :: LengthPercentageAuto :: Length (20f32) , top : taffy :: style :: LengthPercentageAuto :: Length (20f32) , bottom : taffy :: style :: LengthPercentageAuto :: Length (20f32) , } , .. Default :: default () } , taffy :: tree :: MeasureFunc :: Raw (| known_dimensions , available_space | { const TEXT : & str = "HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH" ; crate :: measure_standard_text (known_dimensions , available_space , TEXT , crate :: WritingMode :: Horizontal , None) }) ,) . unwrap () ; + let node11 = taffy . new_leaf_with_context (taffy :: style :: Style { align_items : Some (taffy :: style :: AlignItems :: Center) , align_content : Some (taffy :: style :: AlignContent :: Center) , justify_content : Some (taffy :: style :: JustifyContent :: Center) , flex_grow : 1f32 , margin : taffy :: geometry :: Rect { left : taffy :: style :: LengthPercentageAuto :: Length (20f32) , right : taffy :: style :: LengthPercentageAuto :: Length (20f32) , top : taffy :: style :: LengthPercentageAuto :: Length (20f32) , bottom : taffy :: style :: LengthPercentageAuto :: Length (20f32) , } , .. Default :: default () } , crate :: TextMeasure { text_content : "HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH\u{200b}HHHH" , writing_mode : crate :: WritingMode :: Horizontal , _aspect_ratio : None , } ,) . unwrap () ; let node12 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -76,9 +76,9 @@ fn bevy_issue_9530() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 300f32, "width of node {:?}. Expected {}. Actual {}", node, 300f32, size.width); diff --git a/tests/generated/flex/bevy_issue_9530_reduced.rs b/tests/generated/flex/bevy_issue_9530_reduced.rs index 205b6fa8f..24b5dd567 100644 --- a/tests/generated/flex/bevy_issue_9530_reduced.rs +++ b/tests/generated/flex/bevy_issue_9530_reduced.rs @@ -1,21 +1,16 @@ #[test] fn bevy_issue_9530_reduced() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { flex_grow: 1f32, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH\u{200b}HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH\u{200b}HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node0 = taffy @@ -38,9 +33,9 @@ fn bevy_issue_9530_reduced() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); diff --git a/tests/generated/flex/bevy_issue_9530_reduced2.rs b/tests/generated/flex/bevy_issue_9530_reduced2.rs index 4b7e40744..370badf67 100644 --- a/tests/generated/flex/bevy_issue_9530_reduced2.rs +++ b/tests/generated/flex/bevy_issue_9530_reduced2.rs @@ -1,21 +1,16 @@ #[test] fn bevy_issue_9530_reduced2() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { flex_grow: 1f32, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node0 = taffy @@ -41,9 +36,9 @@ fn bevy_issue_9530_reduced2() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); diff --git a/tests/generated/flex/bevy_issue_9530_reduced3.rs b/tests/generated/flex/bevy_issue_9530_reduced3.rs index 30d0652ee..48c5c5106 100644 --- a/tests/generated/flex/bevy_issue_9530_reduced3.rs +++ b/tests/generated/flex/bevy_issue_9530_reduced3.rs @@ -1,10 +1,10 @@ #[test] fn bevy_issue_9530_reduced3() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { flex_grow: 1f32, margin: taffy::geometry::Rect { @@ -15,16 +15,11 @@ fn bevy_issue_9530_reduced3() { }, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -37,9 +32,9 @@ fn bevy_issue_9530_reduced3() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); diff --git a/tests/generated/flex/bevy_issue_9530_reduced4.rs b/tests/generated/flex/bevy_issue_9530_reduced4.rs index c2a056eeb..f504b5a0d 100644 --- a/tests/generated/flex/bevy_issue_9530_reduced4.rs +++ b/tests/generated/flex/bevy_issue_9530_reduced4.rs @@ -1,10 +1,10 @@ #[test] fn bevy_issue_9530_reduced4() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { margin: taffy::geometry::Rect { left: taffy::style::LengthPercentageAuto::Length(20f32), @@ -14,16 +14,11 @@ fn bevy_issue_9530_reduced4() { }, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -36,9 +31,9 @@ fn bevy_issue_9530_reduced4() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); diff --git a/tests/generated/flex/border_center_child.rs b/tests/generated/flex/border_center_child.rs index 101205234..fa7fc81cb 100644 --- a/tests/generated/flex/border_center_child.rs +++ b/tests/generated/flex/border_center_child.rs @@ -1,8 +1,8 @@ #[test] fn border_center_child() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -32,9 +32,9 @@ fn border_center_child() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/border_container_match_child.rs b/tests/generated/flex/border_container_match_child.rs index 92edc6bc8..f6d2bec30 100644 --- a/tests/generated/flex/border_container_match_child.rs +++ b/tests/generated/flex/border_container_match_child.rs @@ -1,8 +1,8 @@ #[test] fn border_container_match_child() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -27,9 +27,9 @@ fn border_container_match_child() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node, 30f32, size.width); diff --git a/tests/generated/flex/border_flex_child.rs b/tests/generated/flex/border_flex_child.rs index 11e792f67..efe837a27 100644 --- a/tests/generated/flex/border_flex_child.rs +++ b/tests/generated/flex/border_flex_child.rs @@ -1,8 +1,8 @@ #[test] fn border_flex_child() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_grow: 1f32, @@ -28,9 +28,9 @@ fn border_flex_child() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/border_no_child.rs b/tests/generated/flex/border_no_child.rs index d33dea7cc..2c74c87b9 100644 --- a/tests/generated/flex/border_no_child.rs +++ b/tests/generated/flex/border_no_child.rs @@ -1,8 +1,8 @@ #[test] fn border_no_child() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node = taffy .new_leaf(taffy::style::Style { border: taffy::geometry::Rect { @@ -14,9 +14,9 @@ fn border_no_child() { ..Default::default() }) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); diff --git a/tests/generated/flex/border_no_size.rs b/tests/generated/flex/border_no_size.rs index d29f4ebd1..fee05dc15 100644 --- a/tests/generated/flex/border_no_size.rs +++ b/tests/generated/flex/border_no_size.rs @@ -1,8 +1,8 @@ #[test] fn border_no_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node = taffy .new_leaf(taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, @@ -15,9 +15,9 @@ fn border_no_size() { ..Default::default() }) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); diff --git a/tests/generated/flex/border_stretch_child.rs b/tests/generated/flex/border_stretch_child.rs index 961281fcd..52bdb94ac 100644 --- a/tests/generated/flex/border_stretch_child.rs +++ b/tests/generated/flex/border_stretch_child.rs @@ -1,8 +1,8 @@ #[test] fn border_stretch_child() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Length(10f32), height: auto() }, @@ -27,9 +27,9 @@ fn border_stretch_child() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/child_min_max_width_flexing.rs b/tests/generated/flex/child_min_max_width_flexing.rs index f9b3fca1c..86ad2a06b 100644 --- a/tests/generated/flex/child_min_max_width_flexing.rs +++ b/tests/generated/flex/child_min_max_width_flexing.rs @@ -1,8 +1,8 @@ #[test] fn child_min_max_width_flexing() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_grow: 1f32, @@ -34,9 +34,9 @@ fn child_min_max_width_flexing() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); diff --git a/tests/generated/flex/child_with_padding_align_end.rs b/tests/generated/flex/child_with_padding_align_end.rs index f4e448115..b36cdfe39 100644 --- a/tests/generated/flex/child_with_padding_align_end.rs +++ b/tests/generated/flex/child_with_padding_align_end.rs @@ -1,8 +1,8 @@ #[test] fn child_with_padding_align_end() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -33,9 +33,9 @@ fn child_with_padding_align_end() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/flex/container_with_unsized_child.rs b/tests/generated/flex/container_with_unsized_child.rs index 92c0b9ac1..cd86420c0 100644 --- a/tests/generated/flex/container_with_unsized_child.rs +++ b/tests/generated/flex/container_with_unsized_child.rs @@ -1,8 +1,8 @@ #[test] fn container_with_unsized_child() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node = taffy .new_with_children( @@ -16,9 +16,9 @@ fn container_with_unsized_child() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/display_none.rs b/tests/generated/flex/display_none.rs index 34920bdc2..2b77a1e18 100644 --- a/tests/generated/flex/display_none.rs +++ b/tests/generated/flex/display_none.rs @@ -1,8 +1,8 @@ #[test] fn display_none() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { flex_grow: 1f32, ..Default::default() }).unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::None, flex_grow: 1f32, ..Default::default() }) @@ -19,9 +19,9 @@ fn display_none() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/display_none_absolute_child.rs b/tests/generated/flex/display_none_absolute_child.rs index a59d97151..21288a872 100644 --- a/tests/generated/flex/display_none_absolute_child.rs +++ b/tests/generated/flex/display_none_absolute_child.rs @@ -1,8 +1,8 @@ #[test] fn display_none_absolute_child() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { flex_grow: 1f32, ..Default::default() }).unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { @@ -33,9 +33,9 @@ fn display_none_absolute_child() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/display_none_fixed_size.rs b/tests/generated/flex/display_none_fixed_size.rs index 4eb8dfab4..38c153fee 100644 --- a/tests/generated/flex/display_none_fixed_size.rs +++ b/tests/generated/flex/display_none_fixed_size.rs @@ -1,8 +1,8 @@ #[test] fn display_none_fixed_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { flex_grow: 1f32, ..Default::default() }).unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { @@ -26,9 +26,9 @@ fn display_none_fixed_size() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/display_none_only_node.rs b/tests/generated/flex/display_none_only_node.rs index 590c3678f..a66422a21 100644 --- a/tests/generated/flex/display_none_only_node.rs +++ b/tests/generated/flex/display_none_only_node.rs @@ -1,8 +1,8 @@ #[test] fn display_none_only_node() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::None, @@ -13,9 +13,9 @@ fn display_none_only_node() { ..Default::default() }) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); diff --git a/tests/generated/flex/display_none_with_child.rs b/tests/generated/flex/display_none_with_child.rs index 17412e659..77258b2ce 100644 --- a/tests/generated/flex/display_none_with_child.rs +++ b/tests/generated/flex/display_none_with_child.rs @@ -1,8 +1,8 @@ #[test] fn display_none_with_child() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_grow: 1f32, @@ -53,9 +53,9 @@ fn display_none_with_child() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/display_none_with_margin.rs b/tests/generated/flex/display_none_with_margin.rs index f872d14c9..aa8eab980 100644 --- a/tests/generated/flex/display_none_with_margin.rs +++ b/tests/generated/flex/display_none_with_margin.rs @@ -1,8 +1,8 @@ #[test] fn display_none_with_margin() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::None, @@ -32,9 +32,9 @@ fn display_none_with_margin() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/display_none_with_position.rs b/tests/generated/flex/display_none_with_position.rs index 1d2de6c5d..bb666f138 100644 --- a/tests/generated/flex/display_none_with_position.rs +++ b/tests/generated/flex/display_none_with_position.rs @@ -1,8 +1,8 @@ #[test] fn display_none_with_position() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { flex_grow: 1f32, ..Default::default() }).unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { @@ -29,9 +29,9 @@ fn display_none_with_position() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/display_none_with_position_absolute.rs b/tests/generated/flex/display_none_with_position_absolute.rs index 1972d9767..b268f26e9 100644 --- a/tests/generated/flex/display_none_with_position_absolute.rs +++ b/tests/generated/flex/display_none_with_position_absolute.rs @@ -1,8 +1,8 @@ #[test] fn display_none_with_position_absolute() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::None, @@ -26,9 +26,9 @@ fn display_none_with_position_absolute() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/do_not_clamp_height_of_absolute_node_to_height_of_its_overflow_hidden_parent.rs b/tests/generated/flex/do_not_clamp_height_of_absolute_node_to_height_of_its_overflow_hidden_parent.rs index afe52de1e..c793588ab 100644 --- a/tests/generated/flex/do_not_clamp_height_of_absolute_node_to_height_of_its_overflow_hidden_parent.rs +++ b/tests/generated/flex/do_not_clamp_height_of_absolute_node_to_height_of_its_overflow_hidden_parent.rs @@ -1,8 +1,8 @@ #[test] fn do_not_clamp_height_of_absolute_node_to_height_of_its_overflow_hidden_parent() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -45,9 +45,9 @@ fn do_not_clamp_height_of_absolute_node_to_height_of_its_overflow_hidden_parent( &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/flex/flex_basis_and_main_dimen_set_when_flexing.rs b/tests/generated/flex/flex_basis_and_main_dimen_set_when_flexing.rs index dc91db465..93952059d 100644 --- a/tests/generated/flex/flex_basis_and_main_dimen_set_when_flexing.rs +++ b/tests/generated/flex/flex_basis_and_main_dimen_set_when_flexing.rs @@ -1,8 +1,8 @@ #[test] fn flex_basis_and_main_dimen_set_when_flexing() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_grow: 1f32, @@ -34,9 +34,9 @@ fn flex_basis_and_main_dimen_set_when_flexing() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/flex_basis_flex_grow_column.rs b/tests/generated/flex/flex_basis_flex_grow_column.rs index 2d18ce36e..e40e41c37 100644 --- a/tests/generated/flex/flex_basis_flex_grow_column.rs +++ b/tests/generated/flex/flex_basis_flex_grow_column.rs @@ -1,8 +1,8 @@ #[test] fn flex_basis_flex_grow_column() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_grow: 1f32, @@ -24,9 +24,9 @@ fn flex_basis_flex_grow_column() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/flex_basis_flex_grow_row.rs b/tests/generated/flex/flex_basis_flex_grow_row.rs index df5baa3ea..8b16b421d 100644 --- a/tests/generated/flex/flex_basis_flex_grow_row.rs +++ b/tests/generated/flex/flex_basis_flex_grow_row.rs @@ -1,8 +1,8 @@ #[test] fn flex_basis_flex_grow_row() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_grow: 1f32, @@ -23,9 +23,9 @@ fn flex_basis_flex_grow_row() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/flex_basis_flex_shrink_column.rs b/tests/generated/flex/flex_basis_flex_shrink_column.rs index 735ddf102..02d274961 100644 --- a/tests/generated/flex/flex_basis_flex_shrink_column.rs +++ b/tests/generated/flex/flex_basis_flex_shrink_column.rs @@ -1,8 +1,8 @@ #[test] fn flex_basis_flex_shrink_column() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_basis: taffy::style::Dimension::Length(100f32), ..Default::default() }) .unwrap(); @@ -22,9 +22,9 @@ fn flex_basis_flex_shrink_column() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/flex_basis_flex_shrink_row.rs b/tests/generated/flex/flex_basis_flex_shrink_row.rs index 1693370d2..99b9f976c 100644 --- a/tests/generated/flex/flex_basis_flex_shrink_row.rs +++ b/tests/generated/flex/flex_basis_flex_shrink_row.rs @@ -1,8 +1,8 @@ #[test] fn flex_basis_flex_shrink_row() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_basis: taffy::style::Dimension::Length(100f32), ..Default::default() }) .unwrap(); @@ -21,9 +21,9 @@ fn flex_basis_flex_shrink_row() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/flex_basis_larger_than_content_column.rs b/tests/generated/flex/flex_basis_larger_than_content_column.rs index 8cd8dedf4..01c201639 100644 --- a/tests/generated/flex/flex_basis_larger_than_content_column.rs +++ b/tests/generated/flex/flex_basis_larger_than_content_column.rs @@ -1,8 +1,8 @@ #[test] fn flex_basis_larger_than_content_column() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -32,9 +32,9 @@ fn flex_basis_larger_than_content_column() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/flex_basis_larger_than_content_row.rs b/tests/generated/flex/flex_basis_larger_than_content_row.rs index 1f8a391e0..46c2b9aa7 100644 --- a/tests/generated/flex/flex_basis_larger_than_content_row.rs +++ b/tests/generated/flex/flex_basis_larger_than_content_row.rs @@ -1,8 +1,8 @@ #[test] fn flex_basis_larger_than_content_row() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -31,9 +31,9 @@ fn flex_basis_larger_than_content_row() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/flex_basis_overrides_main_size.rs b/tests/generated/flex/flex_basis_overrides_main_size.rs index 277532cba..4150493f6 100644 --- a/tests/generated/flex/flex_basis_overrides_main_size.rs +++ b/tests/generated/flex/flex_basis_overrides_main_size.rs @@ -1,8 +1,8 @@ #[test] fn flex_basis_overrides_main_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_grow: 1f32, @@ -37,9 +37,9 @@ fn flex_basis_overrides_main_size() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/flex_basis_slightly_smaller_then_content_with_flex_grow_large_size.rs b/tests/generated/flex/flex_basis_slightly_smaller_then_content_with_flex_grow_large_size.rs index 3ee0e11df..b06a49ada 100644 --- a/tests/generated/flex/flex_basis_slightly_smaller_then_content_with_flex_grow_large_size.rs +++ b/tests/generated/flex/flex_basis_slightly_smaller_then_content_with_flex_grow_large_size.rs @@ -1,8 +1,8 @@ #[test] fn flex_basis_slightly_smaller_then_content_with_flex_grow_large_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -52,9 +52,9 @@ fn flex_basis_slightly_smaller_then_content_with_flex_grow_large_size() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/flex_basis_smaller_than_content_column.rs b/tests/generated/flex/flex_basis_smaller_than_content_column.rs index 17cf70936..8e90f5d91 100644 --- a/tests/generated/flex/flex_basis_smaller_than_content_column.rs +++ b/tests/generated/flex/flex_basis_smaller_than_content_column.rs @@ -1,8 +1,8 @@ #[test] fn flex_basis_smaller_than_content_column() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -32,9 +32,9 @@ fn flex_basis_smaller_than_content_column() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/flex_basis_smaller_than_content_row.rs b/tests/generated/flex/flex_basis_smaller_than_content_row.rs index ccac188d3..d1f127152 100644 --- a/tests/generated/flex/flex_basis_smaller_than_content_row.rs +++ b/tests/generated/flex/flex_basis_smaller_than_content_row.rs @@ -1,8 +1,8 @@ #[test] fn flex_basis_smaller_than_content_row() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -31,9 +31,9 @@ fn flex_basis_smaller_than_content_row() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/flex_basis_smaller_than_main_dimen_column.rs b/tests/generated/flex/flex_basis_smaller_than_main_dimen_column.rs index fecf6694c..6f2b53242 100644 --- a/tests/generated/flex/flex_basis_smaller_than_main_dimen_column.rs +++ b/tests/generated/flex/flex_basis_smaller_than_main_dimen_column.rs @@ -1,8 +1,8 @@ #[test] fn flex_basis_smaller_than_main_dimen_column() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_basis: taffy::style::Dimension::Length(10f32), @@ -23,9 +23,9 @@ fn flex_basis_smaller_than_main_dimen_column() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/flex/flex_basis_smaller_than_main_dimen_row.rs b/tests/generated/flex/flex_basis_smaller_than_main_dimen_row.rs index 655f1b2ea..374d21b76 100644 --- a/tests/generated/flex/flex_basis_smaller_than_main_dimen_row.rs +++ b/tests/generated/flex/flex_basis_smaller_than_main_dimen_row.rs @@ -1,8 +1,8 @@ #[test] fn flex_basis_smaller_than_main_dimen_row() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_basis: taffy::style::Dimension::Length(10f32), @@ -22,9 +22,9 @@ fn flex_basis_smaller_than_main_dimen_row() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/flex_basis_smaller_then_content_with_flex_grow_large_size.rs b/tests/generated/flex/flex_basis_smaller_then_content_with_flex_grow_large_size.rs index cf7b0663f..c3563d909 100644 --- a/tests/generated/flex/flex_basis_smaller_then_content_with_flex_grow_large_size.rs +++ b/tests/generated/flex/flex_basis_smaller_then_content_with_flex_grow_large_size.rs @@ -1,8 +1,8 @@ #[test] fn flex_basis_smaller_then_content_with_flex_grow_large_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -52,9 +52,9 @@ fn flex_basis_smaller_then_content_with_flex_grow_large_size() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/flex_basis_smaller_then_content_with_flex_grow_small_size.rs b/tests/generated/flex/flex_basis_smaller_then_content_with_flex_grow_small_size.rs index 7a59b2a4c..c9777e4b2 100644 --- a/tests/generated/flex/flex_basis_smaller_then_content_with_flex_grow_small_size.rs +++ b/tests/generated/flex/flex_basis_smaller_then_content_with_flex_grow_small_size.rs @@ -1,8 +1,8 @@ #[test] fn flex_basis_smaller_then_content_with_flex_grow_small_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -52,9 +52,9 @@ fn flex_basis_smaller_then_content_with_flex_grow_small_size() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node, 10f32, size.width); diff --git a/tests/generated/flex/flex_basis_smaller_then_content_with_flex_grow_unconstraint_size.rs b/tests/generated/flex/flex_basis_smaller_then_content_with_flex_grow_unconstraint_size.rs index 7b6079d04..b59ed2770 100644 --- a/tests/generated/flex/flex_basis_smaller_then_content_with_flex_grow_unconstraint_size.rs +++ b/tests/generated/flex/flex_basis_smaller_then_content_with_flex_grow_unconstraint_size.rs @@ -1,8 +1,8 @@ #[test] fn flex_basis_smaller_then_content_with_flex_grow_unconstraint_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -44,9 +44,9 @@ fn flex_basis_smaller_then_content_with_flex_grow_unconstraint_size() { ) .unwrap(); let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0, node1]).unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 90f32, "width of node {:?}. Expected {}. Actual {}", node, 90f32, size.width); diff --git a/tests/generated/flex/flex_basis_smaller_then_content_with_flex_grow_very_large_size.rs b/tests/generated/flex/flex_basis_smaller_then_content_with_flex_grow_very_large_size.rs index c2618c00b..d3de1a45d 100644 --- a/tests/generated/flex/flex_basis_smaller_then_content_with_flex_grow_very_large_size.rs +++ b/tests/generated/flex/flex_basis_smaller_then_content_with_flex_grow_very_large_size.rs @@ -1,8 +1,8 @@ #[test] fn flex_basis_smaller_then_content_with_flex_grow_very_large_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -52,9 +52,9 @@ fn flex_basis_smaller_then_content_with_flex_grow_very_large_size() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/flex/flex_basis_unconstraint_column.rs b/tests/generated/flex/flex_basis_unconstraint_column.rs index 3e2415a4a..3b808dd78 100644 --- a/tests/generated/flex/flex_basis_unconstraint_column.rs +++ b/tests/generated/flex/flex_basis_unconstraint_column.rs @@ -1,8 +1,8 @@ #[test] fn flex_basis_unconstraint_column() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_basis: taffy::style::Dimension::Length(50f32), @@ -16,9 +16,9 @@ fn flex_basis_unconstraint_column() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/flex_basis_unconstraint_row.rs b/tests/generated/flex/flex_basis_unconstraint_row.rs index e87017d21..8bbfd1d00 100644 --- a/tests/generated/flex/flex_basis_unconstraint_row.rs +++ b/tests/generated/flex/flex_basis_unconstraint_row.rs @@ -1,8 +1,8 @@ #[test] fn flex_basis_unconstraint_row() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_basis: taffy::style::Dimension::Length(50f32), @@ -11,9 +11,9 @@ fn flex_basis_unconstraint_row() { }) .unwrap(); let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0]).unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); diff --git a/tests/generated/flex/flex_basis_zero_undefined_main_size.rs b/tests/generated/flex/flex_basis_zero_undefined_main_size.rs index 874bc5be0..fa942a1b3 100644 --- a/tests/generated/flex/flex_basis_zero_undefined_main_size.rs +++ b/tests/generated/flex/flex_basis_zero_undefined_main_size.rs @@ -1,8 +1,8 @@ #[test] fn flex_basis_zero_undefined_main_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -23,9 +23,9 @@ fn flex_basis_zero_undefined_main_size() { ) .unwrap(); let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0]).unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/flex_column_relative_all_sides.rs b/tests/generated/flex/flex_column_relative_all_sides.rs index 1945191ab..b3a225470 100644 --- a/tests/generated/flex/flex_column_relative_all_sides.rs +++ b/tests/generated/flex/flex_column_relative_all_sides.rs @@ -1,8 +1,8 @@ #[test] fn flex_column_relative_all_sides() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Length(40f32), height: auto() }, @@ -28,9 +28,9 @@ fn flex_column_relative_all_sides() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/flex_direction_column.rs b/tests/generated/flex/flex_direction_column.rs index c71f15a77..bb1155432 100644 --- a/tests/generated/flex/flex_direction_column.rs +++ b/tests/generated/flex/flex_direction_column.rs @@ -1,8 +1,8 @@ #[test] fn flex_direction_column() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -34,9 +34,9 @@ fn flex_direction_column() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/flex_direction_column_no_height.rs b/tests/generated/flex/flex_direction_column_no_height.rs index 63589920c..e928c1e15 100644 --- a/tests/generated/flex/flex_direction_column_no_height.rs +++ b/tests/generated/flex/flex_direction_column_no_height.rs @@ -1,8 +1,8 @@ #[test] fn flex_direction_column_no_height() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -31,9 +31,9 @@ fn flex_direction_column_no_height() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/flex_direction_column_reverse.rs b/tests/generated/flex/flex_direction_column_reverse.rs index 7f1e5e880..79de868c7 100644 --- a/tests/generated/flex/flex_direction_column_reverse.rs +++ b/tests/generated/flex/flex_direction_column_reverse.rs @@ -1,8 +1,8 @@ #[test] fn flex_direction_column_reverse() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -34,9 +34,9 @@ fn flex_direction_column_reverse() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/flex_direction_column_reverse_no_height.rs b/tests/generated/flex/flex_direction_column_reverse_no_height.rs index 7b31efee8..7f372a170 100644 --- a/tests/generated/flex/flex_direction_column_reverse_no_height.rs +++ b/tests/generated/flex/flex_direction_column_reverse_no_height.rs @@ -1,8 +1,8 @@ #[test] fn flex_direction_column_reverse_no_height() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -31,9 +31,9 @@ fn flex_direction_column_reverse_no_height() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/flex_direction_row.rs b/tests/generated/flex/flex_direction_row.rs index 227bc611b..ab5eb480e 100644 --- a/tests/generated/flex/flex_direction_row.rs +++ b/tests/generated/flex/flex_direction_row.rs @@ -1,8 +1,8 @@ #[test] fn flex_direction_row() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Length(10f32), height: auto() }, @@ -33,9 +33,9 @@ fn flex_direction_row() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/flex_direction_row_no_width.rs b/tests/generated/flex/flex_direction_row_no_width.rs index ce7a1bc8f..3026bb40e 100644 --- a/tests/generated/flex/flex_direction_row_no_width.rs +++ b/tests/generated/flex/flex_direction_row_no_width.rs @@ -1,8 +1,8 @@ #[test] fn flex_direction_row_no_width() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Length(10f32), height: auto() }, @@ -30,9 +30,9 @@ fn flex_direction_row_no_width() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node, 30f32, size.width); diff --git a/tests/generated/flex/flex_direction_row_reverse.rs b/tests/generated/flex/flex_direction_row_reverse.rs index 6f17941b4..7e6287e78 100644 --- a/tests/generated/flex/flex_direction_row_reverse.rs +++ b/tests/generated/flex/flex_direction_row_reverse.rs @@ -1,8 +1,8 @@ #[test] fn flex_direction_row_reverse() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Length(10f32), height: auto() }, @@ -34,9 +34,9 @@ fn flex_direction_row_reverse() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/flex_grow_child.rs b/tests/generated/flex/flex_grow_child.rs index 4b6aa5373..ad3938849 100644 --- a/tests/generated/flex/flex_grow_child.rs +++ b/tests/generated/flex/flex_grow_child.rs @@ -1,8 +1,8 @@ #[test] fn flex_grow_child() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_grow: 1f32, @@ -12,9 +12,9 @@ fn flex_grow_child() { }) .unwrap(); let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0]).unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); diff --git a/tests/generated/flex/flex_grow_flex_basis_percent_min_max.rs b/tests/generated/flex/flex_grow_flex_basis_percent_min_max.rs index 7b44548d8..4da072d66 100644 --- a/tests/generated/flex/flex_grow_flex_basis_percent_min_max.rs +++ b/tests/generated/flex/flex_grow_flex_basis_percent_min_max.rs @@ -1,8 +1,8 @@ #[test] fn flex_grow_flex_basis_percent_min_max() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_grow: 1f32, @@ -35,9 +35,9 @@ fn flex_grow_flex_basis_percent_min_max() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); diff --git a/tests/generated/flex/flex_grow_height_maximized.rs b/tests/generated/flex/flex_grow_height_maximized.rs index 2273ab77f..32a1554be 100644 --- a/tests/generated/flex/flex_grow_height_maximized.rs +++ b/tests/generated/flex/flex_grow_height_maximized.rs @@ -1,8 +1,8 @@ #[test] fn flex_grow_height_maximized() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { flex_grow: 1f32, @@ -41,9 +41,9 @@ fn flex_grow_height_maximized() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/flex_grow_in_at_most_container.rs b/tests/generated/flex/flex_grow_in_at_most_container.rs index 1e642c59b..8367696ee 100644 --- a/tests/generated/flex/flex_grow_in_at_most_container.rs +++ b/tests/generated/flex/flex_grow_in_at_most_container.rs @@ -1,8 +1,8 @@ #[test] fn flex_grow_in_at_most_container() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { flex_grow: 1f32, @@ -24,9 +24,9 @@ fn flex_grow_in_at_most_container() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/flex_grow_less_than_factor_one.rs b/tests/generated/flex/flex_grow_less_than_factor_one.rs index efb87d3a7..d9e4156af 100644 --- a/tests/generated/flex/flex_grow_less_than_factor_one.rs +++ b/tests/generated/flex/flex_grow_less_than_factor_one.rs @@ -1,8 +1,8 @@ #[test] fn flex_grow_less_than_factor_one() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_grow: 0.2f32, @@ -27,9 +27,9 @@ fn flex_grow_less_than_factor_one() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 500f32, "width of node {:?}. Expected {}. Actual {}", node, 500f32, size.width); diff --git a/tests/generated/flex/flex_grow_root_minimized.rs b/tests/generated/flex/flex_grow_root_minimized.rs index 11a340eb0..2ff09bd9d 100644 --- a/tests/generated/flex/flex_grow_root_minimized.rs +++ b/tests/generated/flex/flex_grow_root_minimized.rs @@ -1,8 +1,8 @@ #[test] fn flex_grow_root_minimized() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { flex_grow: 1f32, @@ -40,9 +40,9 @@ fn flex_grow_root_minimized() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/flex_grow_shrink_at_most.rs b/tests/generated/flex/flex_grow_shrink_at_most.rs index 5e5717e11..dc0ba1195 100644 --- a/tests/generated/flex/flex_grow_shrink_at_most.rs +++ b/tests/generated/flex/flex_grow_shrink_at_most.rs @@ -1,8 +1,8 @@ #[test] fn flex_grow_shrink_at_most() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy.new_leaf(taffy::style::Style { flex_grow: 1f32, flex_shrink: 1f32, ..Default::default() }).unwrap(); let node0 = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node00]).unwrap(); @@ -18,9 +18,9 @@ fn flex_grow_shrink_at_most() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/flex_grow_to_min.rs b/tests/generated/flex/flex_grow_to_min.rs index 1a9679d81..b9c5517f9 100644 --- a/tests/generated/flex/flex_grow_to_min.rs +++ b/tests/generated/flex/flex_grow_to_min.rs @@ -1,8 +1,8 @@ #[test] fn flex_grow_to_min() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { flex_grow: 1f32, flex_shrink: 1f32, ..Default::default() }).unwrap(); let node1 = taffy @@ -23,9 +23,9 @@ fn flex_grow_to_min() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/flex_grow_within_constrained_max_column.rs b/tests/generated/flex/flex_grow_within_constrained_max_column.rs index efe8d96d1..8d5a794ed 100644 --- a/tests/generated/flex/flex_grow_within_constrained_max_column.rs +++ b/tests/generated/flex/flex_grow_within_constrained_max_column.rs @@ -1,8 +1,8 @@ #[test] fn flex_grow_within_constrained_max_column() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_shrink: 1f32, @@ -27,9 +27,9 @@ fn flex_grow_within_constrained_max_column() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/flex_grow_within_constrained_max_row.rs b/tests/generated/flex/flex_grow_within_constrained_max_row.rs index 91a8f01e3..6f952fa12 100644 --- a/tests/generated/flex/flex_grow_within_constrained_max_row.rs +++ b/tests/generated/flex/flex_grow_within_constrained_max_row.rs @@ -1,8 +1,8 @@ #[test] fn flex_grow_within_constrained_max_row() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { flex_shrink: 1f32, @@ -36,9 +36,9 @@ fn flex_grow_within_constrained_max_row() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/flex/flex_grow_within_constrained_max_width.rs b/tests/generated/flex/flex_grow_within_constrained_max_width.rs index d70cf998e..1347bb6e4 100644 --- a/tests/generated/flex/flex_grow_within_constrained_max_width.rs +++ b/tests/generated/flex/flex_grow_within_constrained_max_width.rs @@ -1,8 +1,8 @@ #[test] fn flex_grow_within_constrained_max_width() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { flex_grow: 1f32, @@ -32,9 +32,9 @@ fn flex_grow_within_constrained_max_width() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/flex/flex_grow_within_constrained_min_column.rs b/tests/generated/flex/flex_grow_within_constrained_min_column.rs index 2c8b71a42..338f7db3c 100644 --- a/tests/generated/flex/flex_grow_within_constrained_min_column.rs +++ b/tests/generated/flex/flex_grow_within_constrained_min_column.rs @@ -1,8 +1,8 @@ #[test] fn flex_grow_within_constrained_min_column() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { flex_grow: 1f32, ..Default::default() }).unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { @@ -20,9 +20,9 @@ fn flex_grow_within_constrained_min_column() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); diff --git a/tests/generated/flex/flex_grow_within_constrained_min_max_column.rs b/tests/generated/flex/flex_grow_within_constrained_min_max_column.rs index 13d381256..f76a0b081 100644 --- a/tests/generated/flex/flex_grow_within_constrained_min_max_column.rs +++ b/tests/generated/flex/flex_grow_within_constrained_min_max_column.rs @@ -1,8 +1,8 @@ #[test] fn flex_grow_within_constrained_min_max_column() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { flex_grow: 1f32, ..Default::default() }).unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { @@ -21,9 +21,9 @@ fn flex_grow_within_constrained_min_max_column() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); diff --git a/tests/generated/flex/flex_grow_within_constrained_min_row.rs b/tests/generated/flex/flex_grow_within_constrained_min_row.rs index 6a3ece6e6..b34850662 100644 --- a/tests/generated/flex/flex_grow_within_constrained_min_row.rs +++ b/tests/generated/flex/flex_grow_within_constrained_min_row.rs @@ -1,8 +1,8 @@ #[test] fn flex_grow_within_constrained_min_row() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { flex_grow: 1f32, ..Default::default() }).unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { @@ -20,9 +20,9 @@ fn flex_grow_within_constrained_min_row() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/flex_grow_within_max_width.rs b/tests/generated/flex/flex_grow_within_max_width.rs index e61c740d2..fbbbf3175 100644 --- a/tests/generated/flex/flex_grow_within_max_width.rs +++ b/tests/generated/flex/flex_grow_within_max_width.rs @@ -1,8 +1,8 @@ #[test] fn flex_grow_within_max_width() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { flex_grow: 1f32, @@ -32,9 +32,9 @@ fn flex_grow_within_max_width() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/flex/flex_root_ignored.rs b/tests/generated/flex/flex_root_ignored.rs index af9c4140e..324f7c66d 100644 --- a/tests/generated/flex/flex_root_ignored.rs +++ b/tests/generated/flex/flex_root_ignored.rs @@ -1,8 +1,8 @@ #[test] fn flex_root_ignored() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_grow: 1f32, @@ -28,9 +28,9 @@ fn flex_root_ignored() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/flex_row_relative_all_sides.rs b/tests/generated/flex/flex_row_relative_all_sides.rs index 108e13f1c..4d0f9467d 100644 --- a/tests/generated/flex/flex_row_relative_all_sides.rs +++ b/tests/generated/flex/flex_row_relative_all_sides.rs @@ -1,8 +1,8 @@ #[test] fn flex_row_relative_all_sides() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Length(40f32), height: auto() }, @@ -27,9 +27,9 @@ fn flex_row_relative_all_sides() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/flex_shrink_by_outer_margin_with_max_size.rs b/tests/generated/flex/flex_shrink_by_outer_margin_with_max_size.rs index 067beaaab..8cc648da1 100644 --- a/tests/generated/flex/flex_shrink_by_outer_margin_with_max_size.rs +++ b/tests/generated/flex/flex_shrink_by_outer_margin_with_max_size.rs @@ -1,8 +1,8 @@ #[test] fn flex_shrink_by_outer_margin_with_max_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -29,9 +29,9 @@ fn flex_shrink_by_outer_margin_with_max_size() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); diff --git a/tests/generated/flex/flex_shrink_flex_grow_child_flex_shrink_other_child.rs b/tests/generated/flex/flex_shrink_flex_grow_child_flex_shrink_other_child.rs index 6bcfb9a00..9d3b2c7e9 100644 --- a/tests/generated/flex/flex_shrink_flex_grow_child_flex_shrink_other_child.rs +++ b/tests/generated/flex/flex_shrink_flex_grow_child_flex_shrink_other_child.rs @@ -1,8 +1,8 @@ #[test] fn flex_shrink_flex_grow_child_flex_shrink_other_child() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_grow: 0f32, @@ -37,9 +37,9 @@ fn flex_shrink_flex_grow_child_flex_shrink_other_child() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 500f32, "width of node {:?}. Expected {}. Actual {}", node, 500f32, size.width); diff --git a/tests/generated/flex/flex_shrink_flex_grow_row.rs b/tests/generated/flex/flex_shrink_flex_grow_row.rs index 86c514b89..39e9ceb44 100644 --- a/tests/generated/flex/flex_shrink_flex_grow_row.rs +++ b/tests/generated/flex/flex_shrink_flex_grow_row.rs @@ -1,8 +1,8 @@ #[test] fn flex_shrink_flex_grow_row() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_grow: 0f32, @@ -37,9 +37,9 @@ fn flex_shrink_flex_grow_row() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 500f32, "width of node {:?}. Expected {}. Actual {}", node, 500f32, size.width); diff --git a/tests/generated/flex/flex_shrink_to_zero.rs b/tests/generated/flex/flex_shrink_to_zero.rs index 2e9429204..77fada27b 100644 --- a/tests/generated/flex/flex_shrink_to_zero.rs +++ b/tests/generated/flex/flex_shrink_to_zero.rs @@ -1,8 +1,8 @@ #[test] fn flex_shrink_to_zero() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_shrink: 0f32, @@ -42,9 +42,9 @@ fn flex_shrink_to_zero() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 75f32, "width of node {:?}. Expected {}. Actual {}", node, 75f32, size.width); diff --git a/tests/generated/flex/flex_wrap_align_stretch_fits_one_row.rs b/tests/generated/flex/flex_wrap_align_stretch_fits_one_row.rs index 43d8a3684..39358aefb 100644 --- a/tests/generated/flex/flex_wrap_align_stretch_fits_one_row.rs +++ b/tests/generated/flex/flex_wrap_align_stretch_fits_one_row.rs @@ -1,8 +1,8 @@ #[test] fn flex_wrap_align_stretch_fits_one_row() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Length(50f32), height: auto() }, @@ -28,9 +28,9 @@ fn flex_wrap_align_stretch_fits_one_row() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 150f32, "width of node {:?}. Expected {}. Actual {}", node, 150f32, size.width); diff --git a/tests/generated/flex/flex_wrap_children_with_min_main_overriding_flex_basis.rs b/tests/generated/flex/flex_wrap_children_with_min_main_overriding_flex_basis.rs index 369c6b7f4..0232f8eda 100644 --- a/tests/generated/flex/flex_wrap_children_with_min_main_overriding_flex_basis.rs +++ b/tests/generated/flex/flex_wrap_children_with_min_main_overriding_flex_basis.rs @@ -1,8 +1,8 @@ #[test] fn flex_wrap_children_with_min_main_overriding_flex_basis() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_basis: taffy::style::Dimension::Length(50f32), @@ -29,9 +29,9 @@ fn flex_wrap_children_with_min_main_overriding_flex_basis() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/flex_wrap_wrap_to_child_height.rs b/tests/generated/flex/flex_wrap_wrap_to_child_height.rs index 40b9b9173..c3f8eeb40 100644 --- a/tests/generated/flex/flex_wrap_wrap_to_child_height.rs +++ b/tests/generated/flex/flex_wrap_wrap_to_child_height.rs @@ -1,8 +1,8 @@ #[test] fn flex_wrap_wrap_to_child_height() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node000 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -47,9 +47,9 @@ fn flex_wrap_wrap_to_child_height() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/gap_column_gap_child_margins.rs b/tests/generated/flex/gap_column_gap_child_margins.rs index 04f206835..7411d36cd 100644 --- a/tests/generated/flex/gap_column_gap_child_margins.rs +++ b/tests/generated/flex/gap_column_gap_child_margins.rs @@ -1,8 +1,8 @@ #[test] fn gap_column_gap_child_margins() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_grow: 1f32, @@ -58,9 +58,9 @@ fn gap_column_gap_child_margins() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); diff --git a/tests/generated/flex/gap_column_gap_determines_parent_width.rs b/tests/generated/flex/gap_column_gap_determines_parent_width.rs index 2fc2c06cc..2038cd10b 100644 --- a/tests/generated/flex/gap_column_gap_determines_parent_width.rs +++ b/tests/generated/flex/gap_column_gap_determines_parent_width.rs @@ -1,8 +1,8 @@ #[test] fn gap_column_gap_determines_parent_width() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Length(10f32), height: auto() }, @@ -32,9 +32,9 @@ fn gap_column_gap_determines_parent_width() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); diff --git a/tests/generated/flex/gap_column_gap_flexible.rs b/tests/generated/flex/gap_column_gap_flexible.rs index 7d71fd7a1..269019689 100644 --- a/tests/generated/flex/gap_column_gap_flexible.rs +++ b/tests/generated/flex/gap_column_gap_flexible.rs @@ -1,8 +1,8 @@ #[test] fn gap_column_gap_flexible() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_grow: 1f32, @@ -43,9 +43,9 @@ fn gap_column_gap_flexible() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); diff --git a/tests/generated/flex/gap_column_gap_flexible_undefined_parent.rs b/tests/generated/flex/gap_column_gap_flexible_undefined_parent.rs index 909aed37f..a000cd282 100644 --- a/tests/generated/flex/gap_column_gap_flexible_undefined_parent.rs +++ b/tests/generated/flex/gap_column_gap_flexible_undefined_parent.rs @@ -1,8 +1,8 @@ #[test] fn gap_column_gap_flexible_undefined_parent() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_grow: 1f32, @@ -40,9 +40,9 @@ fn gap_column_gap_flexible_undefined_parent() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); diff --git a/tests/generated/flex/gap_column_gap_inflexible.rs b/tests/generated/flex/gap_column_gap_inflexible.rs index 08b5ba6f2..273986d95 100644 --- a/tests/generated/flex/gap_column_gap_inflexible.rs +++ b/tests/generated/flex/gap_column_gap_inflexible.rs @@ -1,8 +1,8 @@ #[test] fn gap_column_gap_inflexible() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Length(20f32), height: auto() }, @@ -34,9 +34,9 @@ fn gap_column_gap_inflexible() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); diff --git a/tests/generated/flex/gap_column_gap_inflexible_undefined_parent.rs b/tests/generated/flex/gap_column_gap_inflexible_undefined_parent.rs index 6f11c7650..1e743d777 100644 --- a/tests/generated/flex/gap_column_gap_inflexible_undefined_parent.rs +++ b/tests/generated/flex/gap_column_gap_inflexible_undefined_parent.rs @@ -1,8 +1,8 @@ #[test] fn gap_column_gap_inflexible_undefined_parent() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Length(20f32), height: auto() }, @@ -31,9 +31,9 @@ fn gap_column_gap_inflexible_undefined_parent() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); diff --git a/tests/generated/flex/gap_column_gap_justify_center.rs b/tests/generated/flex/gap_column_gap_justify_center.rs index af0112ea4..3b64863da 100644 --- a/tests/generated/flex/gap_column_gap_justify_center.rs +++ b/tests/generated/flex/gap_column_gap_justify_center.rs @@ -1,8 +1,8 @@ #[test] fn gap_column_gap_justify_center() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Length(20f32), height: auto() }, @@ -35,9 +35,9 @@ fn gap_column_gap_justify_center() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/gap_column_gap_justify_flex_end.rs b/tests/generated/flex/gap_column_gap_justify_flex_end.rs index 3e622ea08..11f3ef146 100644 --- a/tests/generated/flex/gap_column_gap_justify_flex_end.rs +++ b/tests/generated/flex/gap_column_gap_justify_flex_end.rs @@ -1,8 +1,8 @@ #[test] fn gap_column_gap_justify_flex_end() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Length(20f32), height: auto() }, @@ -35,9 +35,9 @@ fn gap_column_gap_justify_flex_end() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/gap_column_gap_justify_flex_start.rs b/tests/generated/flex/gap_column_gap_justify_flex_start.rs index 0f4626d0e..86ac84b57 100644 --- a/tests/generated/flex/gap_column_gap_justify_flex_start.rs +++ b/tests/generated/flex/gap_column_gap_justify_flex_start.rs @@ -1,8 +1,8 @@ #[test] fn gap_column_gap_justify_flex_start() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Length(20f32), height: auto() }, @@ -35,9 +35,9 @@ fn gap_column_gap_justify_flex_start() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/gap_column_gap_justify_space_around.rs b/tests/generated/flex/gap_column_gap_justify_space_around.rs index de4fb0774..d269a0a1a 100644 --- a/tests/generated/flex/gap_column_gap_justify_space_around.rs +++ b/tests/generated/flex/gap_column_gap_justify_space_around.rs @@ -1,8 +1,8 @@ #[test] fn gap_column_gap_justify_space_around() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Length(20f32), height: auto() }, @@ -35,9 +35,9 @@ fn gap_column_gap_justify_space_around() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/gap_column_gap_justify_space_between.rs b/tests/generated/flex/gap_column_gap_justify_space_between.rs index 361d08362..97d533c49 100644 --- a/tests/generated/flex/gap_column_gap_justify_space_between.rs +++ b/tests/generated/flex/gap_column_gap_justify_space_between.rs @@ -1,8 +1,8 @@ #[test] fn gap_column_gap_justify_space_between() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Length(20f32), height: auto() }, @@ -35,9 +35,9 @@ fn gap_column_gap_justify_space_between() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/gap_column_gap_justify_space_evenly.rs b/tests/generated/flex/gap_column_gap_justify_space_evenly.rs index 461af1b63..aa5604a28 100644 --- a/tests/generated/flex/gap_column_gap_justify_space_evenly.rs +++ b/tests/generated/flex/gap_column_gap_justify_space_evenly.rs @@ -1,8 +1,8 @@ #[test] fn gap_column_gap_justify_space_evenly() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Length(20f32), height: auto() }, @@ -35,9 +35,9 @@ fn gap_column_gap_justify_space_evenly() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/gap_column_gap_mixed_flexible.rs b/tests/generated/flex/gap_column_gap_mixed_flexible.rs index f2f033028..c1d8bd9a4 100644 --- a/tests/generated/flex/gap_column_gap_mixed_flexible.rs +++ b/tests/generated/flex/gap_column_gap_mixed_flexible.rs @@ -1,8 +1,8 @@ #[test] fn gap_column_gap_mixed_flexible() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Length(20f32), height: auto() }, @@ -36,9 +36,9 @@ fn gap_column_gap_mixed_flexible() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); diff --git a/tests/generated/flex/gap_column_gap_percentage_cyclic_partially_shrinkable.rs b/tests/generated/flex/gap_column_gap_percentage_cyclic_partially_shrinkable.rs index 5ceb39aad..258e79c2a 100644 --- a/tests/generated/flex/gap_column_gap_percentage_cyclic_partially_shrinkable.rs +++ b/tests/generated/flex/gap_column_gap_percentage_cyclic_partially_shrinkable.rs @@ -1,8 +1,8 @@ #[test] fn gap_column_gap_percentage_cyclic_partially_shrinkable() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_shrink: 0f32, @@ -41,9 +41,9 @@ fn gap_column_gap_percentage_cyclic_partially_shrinkable() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); diff --git a/tests/generated/flex/gap_column_gap_percentage_cyclic_shrinkable.rs b/tests/generated/flex/gap_column_gap_percentage_cyclic_shrinkable.rs index 3fbce7894..0f2737ab2 100644 --- a/tests/generated/flex/gap_column_gap_percentage_cyclic_shrinkable.rs +++ b/tests/generated/flex/gap_column_gap_percentage_cyclic_shrinkable.rs @@ -1,8 +1,8 @@ #[test] fn gap_column_gap_percentage_cyclic_shrinkable() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -39,9 +39,9 @@ fn gap_column_gap_percentage_cyclic_shrinkable() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); diff --git a/tests/generated/flex/gap_column_gap_percentage_cyclic_unshrinkable.rs b/tests/generated/flex/gap_column_gap_percentage_cyclic_unshrinkable.rs index f4fdb5aba..b31e3468c 100644 --- a/tests/generated/flex/gap_column_gap_percentage_cyclic_unshrinkable.rs +++ b/tests/generated/flex/gap_column_gap_percentage_cyclic_unshrinkable.rs @@ -1,8 +1,8 @@ #[test] fn gap_column_gap_percentage_cyclic_unshrinkable() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_shrink: 0f32, @@ -42,9 +42,9 @@ fn gap_column_gap_percentage_cyclic_unshrinkable() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); diff --git a/tests/generated/flex/gap_column_gap_percentage_flexible.rs b/tests/generated/flex/gap_column_gap_percentage_flexible.rs index 3fa8247e7..866fde699 100644 --- a/tests/generated/flex/gap_column_gap_percentage_flexible.rs +++ b/tests/generated/flex/gap_column_gap_percentage_flexible.rs @@ -1,8 +1,8 @@ #[test] fn gap_column_gap_percentage_flexible() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_grow: 1f32, @@ -43,9 +43,9 @@ fn gap_column_gap_percentage_flexible() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/gap_column_gap_percentage_flexible_with_padding.rs b/tests/generated/flex/gap_column_gap_percentage_flexible_with_padding.rs index e42c8e967..b399bce9d 100644 --- a/tests/generated/flex/gap_column_gap_percentage_flexible_with_padding.rs +++ b/tests/generated/flex/gap_column_gap_percentage_flexible_with_padding.rs @@ -1,8 +1,8 @@ #[test] fn gap_column_gap_percentage_flexible_with_padding() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_grow: 1f32, @@ -49,9 +49,9 @@ fn gap_column_gap_percentage_flexible_with_padding() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/gap_column_gap_percentage_inflexible.rs b/tests/generated/flex/gap_column_gap_percentage_inflexible.rs index 4116537c9..b9d4bf4ca 100644 --- a/tests/generated/flex/gap_column_gap_percentage_inflexible.rs +++ b/tests/generated/flex/gap_column_gap_percentage_inflexible.rs @@ -1,8 +1,8 @@ #[test] fn gap_column_gap_percentage_inflexible() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Length(20f32), height: auto() }, @@ -34,9 +34,9 @@ fn gap_column_gap_percentage_inflexible() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/gap_column_gap_row_gap_wrapping.rs b/tests/generated/flex/gap_column_gap_row_gap_wrapping.rs index 5b7a8a105..ee0fcf5ef 100644 --- a/tests/generated/flex/gap_column_gap_row_gap_wrapping.rs +++ b/tests/generated/flex/gap_column_gap_row_gap_wrapping.rs @@ -1,8 +1,8 @@ #[test] fn gap_column_gap_row_gap_wrapping() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -98,9 +98,9 @@ fn gap_column_gap_row_gap_wrapping() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); diff --git a/tests/generated/flex/gap_column_gap_start_index.rs b/tests/generated/flex/gap_column_gap_start_index.rs index 5d6047564..70fe193e2 100644 --- a/tests/generated/flex/gap_column_gap_start_index.rs +++ b/tests/generated/flex/gap_column_gap_start_index.rs @@ -1,8 +1,8 @@ #[test] fn gap_column_gap_start_index() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -54,9 +54,9 @@ fn gap_column_gap_start_index() { &[node0, node1, node2, node3], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); diff --git a/tests/generated/flex/gap_column_gap_wrap_align_center.rs b/tests/generated/flex/gap_column_gap_wrap_align_center.rs index 1085c91e5..7fe505d04 100644 --- a/tests/generated/flex/gap_column_gap_wrap_align_center.rs +++ b/tests/generated/flex/gap_column_gap_wrap_align_center.rs @@ -1,8 +1,8 @@ #[test] fn gap_column_gap_wrap_align_center() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -75,9 +75,9 @@ fn gap_column_gap_wrap_align_center() { &[node0, node1, node2, node3, node4, node5], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/gap_column_gap_wrap_align_flex_end.rs b/tests/generated/flex/gap_column_gap_wrap_align_flex_end.rs index df6bf0dee..0910d38d1 100644 --- a/tests/generated/flex/gap_column_gap_wrap_align_flex_end.rs +++ b/tests/generated/flex/gap_column_gap_wrap_align_flex_end.rs @@ -1,8 +1,8 @@ #[test] fn gap_column_gap_wrap_align_flex_end() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -75,9 +75,9 @@ fn gap_column_gap_wrap_align_flex_end() { &[node0, node1, node2, node3, node4, node5], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/gap_column_gap_wrap_align_flex_start.rs b/tests/generated/flex/gap_column_gap_wrap_align_flex_start.rs index 09de805bd..6e212e8dd 100644 --- a/tests/generated/flex/gap_column_gap_wrap_align_flex_start.rs +++ b/tests/generated/flex/gap_column_gap_wrap_align_flex_start.rs @@ -1,8 +1,8 @@ #[test] fn gap_column_gap_wrap_align_flex_start() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -75,9 +75,9 @@ fn gap_column_gap_wrap_align_flex_start() { &[node0, node1, node2, node3, node4, node5], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/gap_column_gap_wrap_align_space_around.rs b/tests/generated/flex/gap_column_gap_wrap_align_space_around.rs index 7013abbc7..2ab879fb8 100644 --- a/tests/generated/flex/gap_column_gap_wrap_align_space_around.rs +++ b/tests/generated/flex/gap_column_gap_wrap_align_space_around.rs @@ -1,8 +1,8 @@ #[test] fn gap_column_gap_wrap_align_space_around() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -75,9 +75,9 @@ fn gap_column_gap_wrap_align_space_around() { &[node0, node1, node2, node3, node4, node5], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/gap_column_gap_wrap_align_space_between.rs b/tests/generated/flex/gap_column_gap_wrap_align_space_between.rs index d035988e4..dd4ee11f7 100644 --- a/tests/generated/flex/gap_column_gap_wrap_align_space_between.rs +++ b/tests/generated/flex/gap_column_gap_wrap_align_space_between.rs @@ -1,8 +1,8 @@ #[test] fn gap_column_gap_wrap_align_space_between() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -75,9 +75,9 @@ fn gap_column_gap_wrap_align_space_between() { &[node0, node1, node2, node3, node4, node5], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/gap_column_gap_wrap_align_stretch.rs b/tests/generated/flex/gap_column_gap_wrap_align_stretch.rs index d16d66efd..a0aec51ec 100644 --- a/tests/generated/flex/gap_column_gap_wrap_align_stretch.rs +++ b/tests/generated/flex/gap_column_gap_wrap_align_stretch.rs @@ -1,8 +1,8 @@ #[test] fn gap_column_gap_wrap_align_stretch() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_grow: 1f32, @@ -53,9 +53,9 @@ fn gap_column_gap_wrap_align_stretch() { &[node0, node1, node2, node3, node4], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 300f32, "width of node {:?}. Expected {}. Actual {}", node, 300f32, size.width); diff --git a/tests/generated/flex/gap_column_row_gap_wrapping.rs b/tests/generated/flex/gap_column_row_gap_wrapping.rs index 770954384..ca738b496 100644 --- a/tests/generated/flex/gap_column_row_gap_wrapping.rs +++ b/tests/generated/flex/gap_column_row_gap_wrapping.rs @@ -1,8 +1,8 @@ #[test] fn gap_column_row_gap_wrapping() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -98,9 +98,9 @@ fn gap_column_row_gap_wrapping() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); diff --git a/tests/generated/flex/gap_row_gap_align_items_end.rs b/tests/generated/flex/gap_row_gap_align_items_end.rs index 72acc9795..aa17daf60 100644 --- a/tests/generated/flex/gap_row_gap_align_items_end.rs +++ b/tests/generated/flex/gap_row_gap_align_items_end.rs @@ -1,8 +1,8 @@ #[test] fn gap_row_gap_align_items_end() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Length(20f32), height: auto() }, @@ -57,9 +57,9 @@ fn gap_row_gap_align_items_end() { &[node0, node1, node2, node3, node4, node5], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/gap_row_gap_align_items_stretch.rs b/tests/generated/flex/gap_row_gap_align_items_stretch.rs index 553752633..e793c5914 100644 --- a/tests/generated/flex/gap_row_gap_align_items_stretch.rs +++ b/tests/generated/flex/gap_row_gap_align_items_stretch.rs @@ -1,8 +1,8 @@ #[test] fn gap_row_gap_align_items_stretch() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Length(20f32), height: auto() }, @@ -58,9 +58,9 @@ fn gap_row_gap_align_items_stretch() { &[node0, node1, node2, node3, node4, node5], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/gap_row_gap_column_child_margins.rs b/tests/generated/flex/gap_row_gap_column_child_margins.rs index 7b3574fb1..fab73e235 100644 --- a/tests/generated/flex/gap_row_gap_column_child_margins.rs +++ b/tests/generated/flex/gap_row_gap_column_child_margins.rs @@ -1,8 +1,8 @@ #[test] fn gap_row_gap_column_child_margins() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_grow: 1f32, @@ -59,9 +59,9 @@ fn gap_row_gap_column_child_margins() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/gap_row_gap_determines_parent_height.rs b/tests/generated/flex/gap_row_gap_determines_parent_height.rs index c78644229..e676be6e9 100644 --- a/tests/generated/flex/gap_row_gap_determines_parent_height.rs +++ b/tests/generated/flex/gap_row_gap_determines_parent_height.rs @@ -1,8 +1,8 @@ #[test] fn gap_row_gap_determines_parent_height() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -33,9 +33,9 @@ fn gap_row_gap_determines_parent_height() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/gap_row_gap_percentage_wrapping.rs b/tests/generated/flex/gap_row_gap_percentage_wrapping.rs index 79cad66c7..9572dc02f 100644 --- a/tests/generated/flex/gap_row_gap_percentage_wrapping.rs +++ b/tests/generated/flex/gap_row_gap_percentage_wrapping.rs @@ -1,8 +1,8 @@ #[test] fn gap_row_gap_percentage_wrapping() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -98,9 +98,9 @@ fn gap_row_gap_percentage_wrapping() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); diff --git a/tests/generated/flex/gap_row_gap_row_wrap_child_margins.rs b/tests/generated/flex/gap_row_gap_row_wrap_child_margins.rs index 438d315b1..4da1e875a 100644 --- a/tests/generated/flex/gap_row_gap_row_wrap_child_margins.rs +++ b/tests/generated/flex/gap_row_gap_row_wrap_child_margins.rs @@ -1,8 +1,8 @@ #[test] fn gap_row_gap_row_wrap_child_margins() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Length(60f32), height: auto() }, @@ -53,9 +53,9 @@ fn gap_row_gap_row_wrap_child_margins() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/intrinsic_sizing_cross_size_column.rs b/tests/generated/flex/intrinsic_sizing_cross_size_column.rs index 501fa24c1..ed72d73ad 100644 --- a/tests/generated/flex/intrinsic_sizing_cross_size_column.rs +++ b/tests/generated/flex/intrinsic_sizing_cross_size_column.rs @@ -1,26 +1,21 @@ #[test] fn intrinsic_sizing_cross_size_column() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); diff --git a/tests/generated/flex/intrinsic_sizing_main_size_column.rs b/tests/generated/flex/intrinsic_sizing_main_size_column.rs index ddc65712d..45e54ae12 100644 --- a/tests/generated/flex/intrinsic_sizing_main_size_column.rs +++ b/tests/generated/flex/intrinsic_sizing_main_size_column.rs @@ -1,26 +1,21 @@ #[test] fn intrinsic_sizing_main_size_column() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Vertical, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH", + writing_mode: crate::WritingMode::Vertical, + _aspect_ratio: None, + }, ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node, 10f32, size.width); diff --git a/tests/generated/flex/intrinsic_sizing_main_size_column_nested.rs b/tests/generated/flex/intrinsic_sizing_main_size_column_nested.rs index b1f1b1058..1eddf053e 100644 --- a/tests/generated/flex/intrinsic_sizing_main_size_column_nested.rs +++ b/tests/generated/flex/intrinsic_sizing_main_size_column_nested.rs @@ -1,21 +1,16 @@ #[test] fn intrinsic_sizing_main_size_column_nested() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Vertical, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH", + writing_mode: crate::WritingMode::Vertical, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -24,9 +19,9 @@ fn intrinsic_sizing_main_size_column_nested() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node, 10f32, size.width); diff --git a/tests/generated/flex/intrinsic_sizing_main_size_column_wrap.rs b/tests/generated/flex/intrinsic_sizing_main_size_column_wrap.rs index 1ee6050eb..86df5a257 100644 --- a/tests/generated/flex/intrinsic_sizing_main_size_column_wrap.rs +++ b/tests/generated/flex/intrinsic_sizing_main_size_column_wrap.rs @@ -1,36 +1,26 @@ #[test] fn intrinsic_sizing_main_size_column_wrap() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Vertical, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH", + writing_mode: crate::WritingMode::Vertical, + _aspect_ratio: None, + }, ) .unwrap(); let node1 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Vertical, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH", + writing_mode: crate::WritingMode::Vertical, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -43,9 +33,9 @@ fn intrinsic_sizing_main_size_column_wrap() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node, 10f32, size.width); diff --git a/tests/generated/flex/intrinsic_sizing_main_size_row.rs b/tests/generated/flex/intrinsic_sizing_main_size_row.rs index 918f2097d..0115031b7 100644 --- a/tests/generated/flex/intrinsic_sizing_main_size_row.rs +++ b/tests/generated/flex/intrinsic_sizing_main_size_row.rs @@ -1,26 +1,21 @@ #[test] fn intrinsic_sizing_main_size_row() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); diff --git a/tests/generated/flex/intrinsic_sizing_main_size_row_nested.rs b/tests/generated/flex/intrinsic_sizing_main_size_row_nested.rs index 1e112d83e..3d2c635d6 100644 --- a/tests/generated/flex/intrinsic_sizing_main_size_row_nested.rs +++ b/tests/generated/flex/intrinsic_sizing_main_size_row_nested.rs @@ -1,27 +1,22 @@ #[test] fn intrinsic_sizing_main_size_row_nested() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0]).unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); diff --git a/tests/generated/flex/intrinsic_sizing_main_size_row_wrap.rs b/tests/generated/flex/intrinsic_sizing_main_size_row_wrap.rs index a0c80c245..d93942f6a 100644 --- a/tests/generated/flex/intrinsic_sizing_main_size_row_wrap.rs +++ b/tests/generated/flex/intrinsic_sizing_main_size_row_wrap.rs @@ -1,36 +1,26 @@ #[test] fn intrinsic_sizing_main_size_row_wrap() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node1 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -39,9 +29,9 @@ fn intrinsic_sizing_main_size_row_wrap() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); diff --git a/tests/generated/flex/justify_content_column_center.rs b/tests/generated/flex/justify_content_column_center.rs index 3c4d887ef..342cf885f 100644 --- a/tests/generated/flex/justify_content_column_center.rs +++ b/tests/generated/flex/justify_content_column_center.rs @@ -1,8 +1,8 @@ #[test] fn justify_content_column_center() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -35,9 +35,9 @@ fn justify_content_column_center() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/justify_content_column_center_negative_space.rs b/tests/generated/flex/justify_content_column_center_negative_space.rs index 6c19477ba..d672639f9 100644 --- a/tests/generated/flex/justify_content_column_center_negative_space.rs +++ b/tests/generated/flex/justify_content_column_center_negative_space.rs @@ -1,8 +1,8 @@ #[test] fn justify_content_column_center_negative_space() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { flex_shrink: 0f32, @@ -66,9 +66,9 @@ fn justify_content_column_center_negative_space() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); diff --git a/tests/generated/flex/justify_content_column_center_negative_space_gap.rs b/tests/generated/flex/justify_content_column_center_negative_space_gap.rs index cf4605f8c..96b8ad849 100644 --- a/tests/generated/flex/justify_content_column_center_negative_space_gap.rs +++ b/tests/generated/flex/justify_content_column_center_negative_space_gap.rs @@ -1,8 +1,8 @@ #[test] fn justify_content_column_center_negative_space_gap() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { flex_shrink: 0f32, @@ -70,9 +70,9 @@ fn justify_content_column_center_negative_space_gap() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); diff --git a/tests/generated/flex/justify_content_column_end.rs b/tests/generated/flex/justify_content_column_end.rs index ac395a5aa..01f7e3d09 100644 --- a/tests/generated/flex/justify_content_column_end.rs +++ b/tests/generated/flex/justify_content_column_end.rs @@ -1,8 +1,8 @@ #[test] fn justify_content_column_end() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -35,9 +35,9 @@ fn justify_content_column_end() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/justify_content_column_end_negative_space.rs b/tests/generated/flex/justify_content_column_end_negative_space.rs index 07de47999..de925a03e 100644 --- a/tests/generated/flex/justify_content_column_end_negative_space.rs +++ b/tests/generated/flex/justify_content_column_end_negative_space.rs @@ -1,8 +1,8 @@ #[test] fn justify_content_column_end_negative_space() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { flex_shrink: 0f32, @@ -66,9 +66,9 @@ fn justify_content_column_end_negative_space() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); diff --git a/tests/generated/flex/justify_content_column_end_negative_space_gap.rs b/tests/generated/flex/justify_content_column_end_negative_space_gap.rs index 6f07f294f..f8370e2c9 100644 --- a/tests/generated/flex/justify_content_column_end_negative_space_gap.rs +++ b/tests/generated/flex/justify_content_column_end_negative_space_gap.rs @@ -1,8 +1,8 @@ #[test] fn justify_content_column_end_negative_space_gap() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { flex_shrink: 0f32, @@ -70,9 +70,9 @@ fn justify_content_column_end_negative_space_gap() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); diff --git a/tests/generated/flex/justify_content_column_end_reverse.rs b/tests/generated/flex/justify_content_column_end_reverse.rs index d0343ad92..0b66e636d 100644 --- a/tests/generated/flex/justify_content_column_end_reverse.rs +++ b/tests/generated/flex/justify_content_column_end_reverse.rs @@ -1,8 +1,8 @@ #[test] fn justify_content_column_end_reverse() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -35,9 +35,9 @@ fn justify_content_column_end_reverse() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/justify_content_column_flex_end.rs b/tests/generated/flex/justify_content_column_flex_end.rs index ea608edce..0862a2cea 100644 --- a/tests/generated/flex/justify_content_column_flex_end.rs +++ b/tests/generated/flex/justify_content_column_flex_end.rs @@ -1,8 +1,8 @@ #[test] fn justify_content_column_flex_end() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -35,9 +35,9 @@ fn justify_content_column_flex_end() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/justify_content_column_flex_end_reverse.rs b/tests/generated/flex/justify_content_column_flex_end_reverse.rs index c81ec4a5c..5e3f7d2c5 100644 --- a/tests/generated/flex/justify_content_column_flex_end_reverse.rs +++ b/tests/generated/flex/justify_content_column_flex_end_reverse.rs @@ -1,8 +1,8 @@ #[test] fn justify_content_column_flex_end_reverse() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -35,9 +35,9 @@ fn justify_content_column_flex_end_reverse() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/justify_content_column_flex_start.rs b/tests/generated/flex/justify_content_column_flex_start.rs index 594141875..9a5d141bf 100644 --- a/tests/generated/flex/justify_content_column_flex_start.rs +++ b/tests/generated/flex/justify_content_column_flex_start.rs @@ -1,8 +1,8 @@ #[test] fn justify_content_column_flex_start() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -35,9 +35,9 @@ fn justify_content_column_flex_start() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/justify_content_column_flex_start_reverse.rs b/tests/generated/flex/justify_content_column_flex_start_reverse.rs index 1e647ce9d..a3828d644 100644 --- a/tests/generated/flex/justify_content_column_flex_start_reverse.rs +++ b/tests/generated/flex/justify_content_column_flex_start_reverse.rs @@ -1,8 +1,8 @@ #[test] fn justify_content_column_flex_start_reverse() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -35,9 +35,9 @@ fn justify_content_column_flex_start_reverse() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/justify_content_column_max_height_and_margin.rs b/tests/generated/flex/justify_content_column_max_height_and_margin.rs index 759dcf4f5..4afe65e72 100644 --- a/tests/generated/flex/justify_content_column_max_height_and_margin.rs +++ b/tests/generated/flex/justify_content_column_max_height_and_margin.rs @@ -1,8 +1,8 @@ #[test] fn justify_content_column_max_height_and_margin() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -31,9 +31,9 @@ fn justify_content_column_max_height_and_margin() { ) .unwrap(); let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0]).unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); diff --git a/tests/generated/flex/justify_content_column_min_height_and_margin.rs b/tests/generated/flex/justify_content_column_min_height_and_margin.rs index 004aa3cda..0e3a855bd 100644 --- a/tests/generated/flex/justify_content_column_min_height_and_margin.rs +++ b/tests/generated/flex/justify_content_column_min_height_and_margin.rs @@ -1,8 +1,8 @@ #[test] fn justify_content_column_min_height_and_margin() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -30,9 +30,9 @@ fn justify_content_column_min_height_and_margin() { ) .unwrap(); let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0]).unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); diff --git a/tests/generated/flex/justify_content_column_min_height_and_margin_bottom.rs b/tests/generated/flex/justify_content_column_min_height_and_margin_bottom.rs index 5b2f766fc..e60fba8db 100644 --- a/tests/generated/flex/justify_content_column_min_height_and_margin_bottom.rs +++ b/tests/generated/flex/justify_content_column_min_height_and_margin_bottom.rs @@ -1,8 +1,8 @@ #[test] fn justify_content_column_min_height_and_margin_bottom() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -29,9 +29,9 @@ fn justify_content_column_min_height_and_margin_bottom() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); diff --git a/tests/generated/flex/justify_content_column_min_height_and_margin_top.rs b/tests/generated/flex/justify_content_column_min_height_and_margin_top.rs index dafac6293..ae4d916e2 100644 --- a/tests/generated/flex/justify_content_column_min_height_and_margin_top.rs +++ b/tests/generated/flex/justify_content_column_min_height_and_margin_top.rs @@ -1,8 +1,8 @@ #[test] fn justify_content_column_min_height_and_margin_top() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -29,9 +29,9 @@ fn justify_content_column_min_height_and_margin_top() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); diff --git a/tests/generated/flex/justify_content_column_space_around.rs b/tests/generated/flex/justify_content_column_space_around.rs index aca634d7f..f0ba29095 100644 --- a/tests/generated/flex/justify_content_column_space_around.rs +++ b/tests/generated/flex/justify_content_column_space_around.rs @@ -1,8 +1,8 @@ #[test] fn justify_content_column_space_around() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -35,9 +35,9 @@ fn justify_content_column_space_around() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/justify_content_column_space_around_negative_space.rs b/tests/generated/flex/justify_content_column_space_around_negative_space.rs index 484a898e4..d7b6ec9fe 100644 --- a/tests/generated/flex/justify_content_column_space_around_negative_space.rs +++ b/tests/generated/flex/justify_content_column_space_around_negative_space.rs @@ -1,8 +1,8 @@ #[test] fn justify_content_column_space_around_negative_space() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { flex_shrink: 0f32, @@ -66,9 +66,9 @@ fn justify_content_column_space_around_negative_space() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); diff --git a/tests/generated/flex/justify_content_column_space_around_negative_space_gap.rs b/tests/generated/flex/justify_content_column_space_around_negative_space_gap.rs index dc5681a78..6a14b9745 100644 --- a/tests/generated/flex/justify_content_column_space_around_negative_space_gap.rs +++ b/tests/generated/flex/justify_content_column_space_around_negative_space_gap.rs @@ -1,8 +1,8 @@ #[test] fn justify_content_column_space_around_negative_space_gap() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { flex_shrink: 0f32, @@ -70,9 +70,9 @@ fn justify_content_column_space_around_negative_space_gap() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); diff --git a/tests/generated/flex/justify_content_column_space_between.rs b/tests/generated/flex/justify_content_column_space_between.rs index e1c90ffbe..7751511b8 100644 --- a/tests/generated/flex/justify_content_column_space_between.rs +++ b/tests/generated/flex/justify_content_column_space_between.rs @@ -1,8 +1,8 @@ #[test] fn justify_content_column_space_between() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -35,9 +35,9 @@ fn justify_content_column_space_between() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/justify_content_column_space_between_negative_space.rs b/tests/generated/flex/justify_content_column_space_between_negative_space.rs index 8916d0361..7539beb26 100644 --- a/tests/generated/flex/justify_content_column_space_between_negative_space.rs +++ b/tests/generated/flex/justify_content_column_space_between_negative_space.rs @@ -1,8 +1,8 @@ #[test] fn justify_content_column_space_between_negative_space() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { flex_shrink: 0f32, @@ -66,9 +66,9 @@ fn justify_content_column_space_between_negative_space() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); diff --git a/tests/generated/flex/justify_content_column_space_between_negative_space_gap.rs b/tests/generated/flex/justify_content_column_space_between_negative_space_gap.rs index b618db127..0718453df 100644 --- a/tests/generated/flex/justify_content_column_space_between_negative_space_gap.rs +++ b/tests/generated/flex/justify_content_column_space_between_negative_space_gap.rs @@ -1,8 +1,8 @@ #[test] fn justify_content_column_space_between_negative_space_gap() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { flex_shrink: 0f32, @@ -70,9 +70,9 @@ fn justify_content_column_space_between_negative_space_gap() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); diff --git a/tests/generated/flex/justify_content_column_space_evenly.rs b/tests/generated/flex/justify_content_column_space_evenly.rs index d41f52044..9ec052d58 100644 --- a/tests/generated/flex/justify_content_column_space_evenly.rs +++ b/tests/generated/flex/justify_content_column_space_evenly.rs @@ -1,8 +1,8 @@ #[test] fn justify_content_column_space_evenly() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -35,9 +35,9 @@ fn justify_content_column_space_evenly() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/justify_content_column_space_evenly_negative_space.rs b/tests/generated/flex/justify_content_column_space_evenly_negative_space.rs index 11306a5d5..81d4d0ee3 100644 --- a/tests/generated/flex/justify_content_column_space_evenly_negative_space.rs +++ b/tests/generated/flex/justify_content_column_space_evenly_negative_space.rs @@ -1,8 +1,8 @@ #[test] fn justify_content_column_space_evenly_negative_space() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { flex_shrink: 0f32, @@ -66,9 +66,9 @@ fn justify_content_column_space_evenly_negative_space() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); diff --git a/tests/generated/flex/justify_content_column_space_evenly_negative_space_gap.rs b/tests/generated/flex/justify_content_column_space_evenly_negative_space_gap.rs index c56d8ebdb..842f0ae40 100644 --- a/tests/generated/flex/justify_content_column_space_evenly_negative_space_gap.rs +++ b/tests/generated/flex/justify_content_column_space_evenly_negative_space_gap.rs @@ -1,8 +1,8 @@ #[test] fn justify_content_column_space_evenly_negative_space_gap() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { flex_shrink: 0f32, @@ -70,9 +70,9 @@ fn justify_content_column_space_evenly_negative_space_gap() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); diff --git a/tests/generated/flex/justify_content_column_start.rs b/tests/generated/flex/justify_content_column_start.rs index 5ad5314ef..45f40ab92 100644 --- a/tests/generated/flex/justify_content_column_start.rs +++ b/tests/generated/flex/justify_content_column_start.rs @@ -1,8 +1,8 @@ #[test] fn justify_content_column_start() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -35,9 +35,9 @@ fn justify_content_column_start() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/justify_content_column_start_negative_space.rs b/tests/generated/flex/justify_content_column_start_negative_space.rs index 0e2c617bf..af4d7d838 100644 --- a/tests/generated/flex/justify_content_column_start_negative_space.rs +++ b/tests/generated/flex/justify_content_column_start_negative_space.rs @@ -1,8 +1,8 @@ #[test] fn justify_content_column_start_negative_space() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { flex_shrink: 0f32, @@ -66,9 +66,9 @@ fn justify_content_column_start_negative_space() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); diff --git a/tests/generated/flex/justify_content_column_start_negative_space_gap.rs b/tests/generated/flex/justify_content_column_start_negative_space_gap.rs index 4982d423d..86f6311d4 100644 --- a/tests/generated/flex/justify_content_column_start_negative_space_gap.rs +++ b/tests/generated/flex/justify_content_column_start_negative_space_gap.rs @@ -1,8 +1,8 @@ #[test] fn justify_content_column_start_negative_space_gap() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { flex_shrink: 0f32, @@ -70,9 +70,9 @@ fn justify_content_column_start_negative_space_gap() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); diff --git a/tests/generated/flex/justify_content_column_start_reverse.rs b/tests/generated/flex/justify_content_column_start_reverse.rs index b2c46fcd6..6a55ab61b 100644 --- a/tests/generated/flex/justify_content_column_start_reverse.rs +++ b/tests/generated/flex/justify_content_column_start_reverse.rs @@ -1,8 +1,8 @@ #[test] fn justify_content_column_start_reverse() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -35,9 +35,9 @@ fn justify_content_column_start_reverse() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/justify_content_min_max.rs b/tests/generated/flex/justify_content_min_max.rs index d4329c99b..06337a0ae 100644 --- a/tests/generated/flex/justify_content_min_max.rs +++ b/tests/generated/flex/justify_content_min_max.rs @@ -1,8 +1,8 @@ #[test] fn justify_content_min_max() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -25,9 +25,9 @@ fn justify_content_min_max() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/justify_content_min_width_with_padding_child_width_greater_than_parent.rs b/tests/generated/flex/justify_content_min_width_with_padding_child_width_greater_than_parent.rs index 0e4e98121..0c4a94746 100644 --- a/tests/generated/flex/justify_content_min_width_with_padding_child_width_greater_than_parent.rs +++ b/tests/generated/flex/justify_content_min_width_with_padding_child_width_greater_than_parent.rs @@ -1,8 +1,8 @@ #[test] fn justify_content_min_width_with_padding_child_width_greater_than_parent() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node000 = taffy .new_leaf(taffy::style::Style { align_content: Some(taffy::style::AlignContent::Stretch), @@ -50,9 +50,9 @@ fn justify_content_min_width_with_padding_child_width_greater_than_parent() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 1000f32, "width of node {:?}. Expected {}. Actual {}", node, 1000f32, size.width); diff --git a/tests/generated/flex/justify_content_min_width_with_padding_child_width_lower_than_parent.rs b/tests/generated/flex/justify_content_min_width_with_padding_child_width_lower_than_parent.rs index a66a006ca..fc47075db 100644 --- a/tests/generated/flex/justify_content_min_width_with_padding_child_width_lower_than_parent.rs +++ b/tests/generated/flex/justify_content_min_width_with_padding_child_width_lower_than_parent.rs @@ -1,8 +1,8 @@ #[test] fn justify_content_min_width_with_padding_child_width_lower_than_parent() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node000 = taffy .new_leaf(taffy::style::Style { align_content: Some(taffy::style::AlignContent::Stretch), @@ -50,9 +50,9 @@ fn justify_content_min_width_with_padding_child_width_lower_than_parent() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 1080f32, "width of node {:?}. Expected {}. Actual {}", node, 1080f32, size.width); diff --git a/tests/generated/flex/justify_content_overflow_min_max.rs b/tests/generated/flex/justify_content_overflow_min_max.rs index e8980efac..9e195058e 100644 --- a/tests/generated/flex/justify_content_overflow_min_max.rs +++ b/tests/generated/flex/justify_content_overflow_min_max.rs @@ -1,8 +1,8 @@ #[test] fn justify_content_overflow_min_max() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_shrink: 0f32, @@ -45,9 +45,9 @@ fn justify_content_overflow_min_max() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/flex/justify_content_row_center.rs b/tests/generated/flex/justify_content_row_center.rs index 1f3d05e21..a75dc1c82 100644 --- a/tests/generated/flex/justify_content_row_center.rs +++ b/tests/generated/flex/justify_content_row_center.rs @@ -1,8 +1,8 @@ #[test] fn justify_content_row_center() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Length(10f32), height: auto() }, @@ -34,9 +34,9 @@ fn justify_content_row_center() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/justify_content_row_flex_end.rs b/tests/generated/flex/justify_content_row_flex_end.rs index 9c649b662..f3b2a3c51 100644 --- a/tests/generated/flex/justify_content_row_flex_end.rs +++ b/tests/generated/flex/justify_content_row_flex_end.rs @@ -1,8 +1,8 @@ #[test] fn justify_content_row_flex_end() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Length(10f32), height: auto() }, @@ -34,9 +34,9 @@ fn justify_content_row_flex_end() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/justify_content_row_flex_start.rs b/tests/generated/flex/justify_content_row_flex_start.rs index 73f4d0a27..7b6f6fbd7 100644 --- a/tests/generated/flex/justify_content_row_flex_start.rs +++ b/tests/generated/flex/justify_content_row_flex_start.rs @@ -1,8 +1,8 @@ #[test] fn justify_content_row_flex_start() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Length(10f32), height: auto() }, @@ -34,9 +34,9 @@ fn justify_content_row_flex_start() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/justify_content_row_max_width_and_margin.rs b/tests/generated/flex/justify_content_row_max_width_and_margin.rs index d18ac2023..55ac943b6 100644 --- a/tests/generated/flex/justify_content_row_max_width_and_margin.rs +++ b/tests/generated/flex/justify_content_row_max_width_and_margin.rs @@ -1,8 +1,8 @@ #[test] fn justify_content_row_max_width_and_margin() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -29,9 +29,9 @@ fn justify_content_row_max_width_and_margin() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); diff --git a/tests/generated/flex/justify_content_row_min_width_and_margin.rs b/tests/generated/flex/justify_content_row_min_width_and_margin.rs index a271eed75..d01871dc0 100644 --- a/tests/generated/flex/justify_content_row_min_width_and_margin.rs +++ b/tests/generated/flex/justify_content_row_min_width_and_margin.rs @@ -1,8 +1,8 @@ #[test] fn justify_content_row_min_width_and_margin() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -28,9 +28,9 @@ fn justify_content_row_min_width_and_margin() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/flex/justify_content_row_space_around.rs b/tests/generated/flex/justify_content_row_space_around.rs index 695e94f4d..9c4417581 100644 --- a/tests/generated/flex/justify_content_row_space_around.rs +++ b/tests/generated/flex/justify_content_row_space_around.rs @@ -1,8 +1,8 @@ #[test] fn justify_content_row_space_around() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Length(10f32), height: auto() }, @@ -34,9 +34,9 @@ fn justify_content_row_space_around() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/justify_content_row_space_between.rs b/tests/generated/flex/justify_content_row_space_between.rs index 3ba5e955d..837cd6402 100644 --- a/tests/generated/flex/justify_content_row_space_between.rs +++ b/tests/generated/flex/justify_content_row_space_between.rs @@ -1,8 +1,8 @@ #[test] fn justify_content_row_space_between() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Length(10f32), height: auto() }, @@ -34,9 +34,9 @@ fn justify_content_row_space_between() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/justify_content_row_space_evenly.rs b/tests/generated/flex/justify_content_row_space_evenly.rs index 16d783b12..02f5f1899 100644 --- a/tests/generated/flex/justify_content_row_space_evenly.rs +++ b/tests/generated/flex/justify_content_row_space_evenly.rs @@ -1,8 +1,8 @@ #[test] fn justify_content_row_space_evenly() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -34,9 +34,9 @@ fn justify_content_row_space_evenly() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/margin_and_flex_column.rs b/tests/generated/flex/margin_and_flex_column.rs index 5c8846b5e..a2fb40172 100644 --- a/tests/generated/flex/margin_and_flex_column.rs +++ b/tests/generated/flex/margin_and_flex_column.rs @@ -1,8 +1,8 @@ #[test] fn margin_and_flex_column() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_grow: 1f32, @@ -28,9 +28,9 @@ fn margin_and_flex_column() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/margin_and_flex_row.rs b/tests/generated/flex/margin_and_flex_row.rs index 41b14f2e5..7c12bf47a 100644 --- a/tests/generated/flex/margin_and_flex_row.rs +++ b/tests/generated/flex/margin_and_flex_row.rs @@ -1,8 +1,8 @@ #[test] fn margin_and_flex_row() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_grow: 1f32, @@ -27,9 +27,9 @@ fn margin_and_flex_row() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/margin_and_stretch_column.rs b/tests/generated/flex/margin_and_stretch_column.rs index 5adc9957d..cfac83aee 100644 --- a/tests/generated/flex/margin_and_stretch_column.rs +++ b/tests/generated/flex/margin_and_stretch_column.rs @@ -1,8 +1,8 @@ #[test] fn margin_and_stretch_column() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_grow: 1f32, @@ -28,9 +28,9 @@ fn margin_and_stretch_column() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/margin_and_stretch_row.rs b/tests/generated/flex/margin_and_stretch_row.rs index 0d27f2831..987df4220 100644 --- a/tests/generated/flex/margin_and_stretch_row.rs +++ b/tests/generated/flex/margin_and_stretch_row.rs @@ -1,8 +1,8 @@ #[test] fn margin_and_stretch_row() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_grow: 1f32, @@ -27,9 +27,9 @@ fn margin_and_stretch_row() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/margin_auto_bottom.rs b/tests/generated/flex/margin_auto_bottom.rs index de5fccb3e..f5542479f 100644 --- a/tests/generated/flex/margin_auto_bottom.rs +++ b/tests/generated/flex/margin_auto_bottom.rs @@ -1,8 +1,8 @@ #[test] fn margin_auto_bottom() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -40,9 +40,9 @@ fn margin_auto_bottom() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/flex/margin_auto_bottom_and_top.rs b/tests/generated/flex/margin_auto_bottom_and_top.rs index f3da0f799..fc7ab2472 100644 --- a/tests/generated/flex/margin_auto_bottom_and_top.rs +++ b/tests/generated/flex/margin_auto_bottom_and_top.rs @@ -1,8 +1,8 @@ #[test] fn margin_auto_bottom_and_top() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -40,9 +40,9 @@ fn margin_auto_bottom_and_top() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/flex/margin_auto_bottom_and_top_justify_center.rs b/tests/generated/flex/margin_auto_bottom_and_top_justify_center.rs index 606eff6d8..bf78c6f83 100644 --- a/tests/generated/flex/margin_auto_bottom_and_top_justify_center.rs +++ b/tests/generated/flex/margin_auto_bottom_and_top_justify_center.rs @@ -1,8 +1,8 @@ #[test] fn margin_auto_bottom_and_top_justify_center() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -40,9 +40,9 @@ fn margin_auto_bottom_and_top_justify_center() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/flex/margin_auto_left.rs b/tests/generated/flex/margin_auto_left.rs index 0700cc9ee..eedf48bc4 100644 --- a/tests/generated/flex/margin_auto_left.rs +++ b/tests/generated/flex/margin_auto_left.rs @@ -1,8 +1,8 @@ #[test] fn margin_auto_left() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -40,9 +40,9 @@ fn margin_auto_left() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/flex/margin_auto_left_and_right.rs b/tests/generated/flex/margin_auto_left_and_right.rs index d9d01e6b9..a7850d737 100644 --- a/tests/generated/flex/margin_auto_left_and_right.rs +++ b/tests/generated/flex/margin_auto_left_and_right.rs @@ -1,8 +1,8 @@ #[test] fn margin_auto_left_and_right() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -39,9 +39,9 @@ fn margin_auto_left_and_right() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/flex/margin_auto_left_and_right_column.rs b/tests/generated/flex/margin_auto_left_and_right_column.rs index aa5fa5346..fe9350384 100644 --- a/tests/generated/flex/margin_auto_left_and_right_column.rs +++ b/tests/generated/flex/margin_auto_left_and_right_column.rs @@ -1,8 +1,8 @@ #[test] fn margin_auto_left_and_right_column() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -40,9 +40,9 @@ fn margin_auto_left_and_right_column() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/flex/margin_auto_left_and_right_column_and_center.rs b/tests/generated/flex/margin_auto_left_and_right_column_and_center.rs index 7f0770f9b..459df626e 100644 --- a/tests/generated/flex/margin_auto_left_and_right_column_and_center.rs +++ b/tests/generated/flex/margin_auto_left_and_right_column_and_center.rs @@ -1,8 +1,8 @@ #[test] fn margin_auto_left_and_right_column_and_center() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -40,9 +40,9 @@ fn margin_auto_left_and_right_column_and_center() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/flex/margin_auto_left_and_right_stretch.rs b/tests/generated/flex/margin_auto_left_and_right_stretch.rs index dbb84eb41..6ac08a9de 100644 --- a/tests/generated/flex/margin_auto_left_and_right_stretch.rs +++ b/tests/generated/flex/margin_auto_left_and_right_stretch.rs @@ -1,8 +1,8 @@ #[test] fn margin_auto_left_and_right_stretch() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -40,9 +40,9 @@ fn margin_auto_left_and_right_stretch() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/flex/margin_auto_left_child_bigger_than_parent.rs b/tests/generated/flex/margin_auto_left_child_bigger_than_parent.rs index a7608a4f4..3f1c42ced 100644 --- a/tests/generated/flex/margin_auto_left_child_bigger_than_parent.rs +++ b/tests/generated/flex/margin_auto_left_child_bigger_than_parent.rs @@ -1,8 +1,8 @@ #[test] fn margin_auto_left_child_bigger_than_parent() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -31,9 +31,9 @@ fn margin_auto_left_child_bigger_than_parent() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 52f32, "width of node {:?}. Expected {}. Actual {}", node, 52f32, size.width); diff --git a/tests/generated/flex/margin_auto_left_fix_right_child_bigger_than_parent.rs b/tests/generated/flex/margin_auto_left_fix_right_child_bigger_than_parent.rs index 06e5197ce..4353c2c96 100644 --- a/tests/generated/flex/margin_auto_left_fix_right_child_bigger_than_parent.rs +++ b/tests/generated/flex/margin_auto_left_fix_right_child_bigger_than_parent.rs @@ -1,8 +1,8 @@ #[test] fn margin_auto_left_fix_right_child_bigger_than_parent() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -31,9 +31,9 @@ fn margin_auto_left_fix_right_child_bigger_than_parent() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 52f32, "width of node {:?}. Expected {}. Actual {}", node, 52f32, size.width); diff --git a/tests/generated/flex/margin_auto_left_right_child_bigger_than_parent.rs b/tests/generated/flex/margin_auto_left_right_child_bigger_than_parent.rs index 5947c97c3..7b05ee2f6 100644 --- a/tests/generated/flex/margin_auto_left_right_child_bigger_than_parent.rs +++ b/tests/generated/flex/margin_auto_left_right_child_bigger_than_parent.rs @@ -1,8 +1,8 @@ #[test] fn margin_auto_left_right_child_bigger_than_parent() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -31,9 +31,9 @@ fn margin_auto_left_right_child_bigger_than_parent() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 52f32, "width of node {:?}. Expected {}. Actual {}", node, 52f32, size.width); diff --git a/tests/generated/flex/margin_auto_left_stretching_child.rs b/tests/generated/flex/margin_auto_left_stretching_child.rs index 2e3d9e71e..0434b5d27 100644 --- a/tests/generated/flex/margin_auto_left_stretching_child.rs +++ b/tests/generated/flex/margin_auto_left_stretching_child.rs @@ -1,8 +1,8 @@ #[test] fn margin_auto_left_stretching_child() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_grow: 1f32, @@ -39,9 +39,9 @@ fn margin_auto_left_stretching_child() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/flex/margin_auto_mutiple_children_column.rs b/tests/generated/flex/margin_auto_mutiple_children_column.rs index 09c5e771a..8b5a882c8 100644 --- a/tests/generated/flex/margin_auto_mutiple_children_column.rs +++ b/tests/generated/flex/margin_auto_mutiple_children_column.rs @@ -1,8 +1,8 @@ #[test] fn margin_auto_mutiple_children_column() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -56,9 +56,9 @@ fn margin_auto_mutiple_children_column() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/flex/margin_auto_mutiple_children_row.rs b/tests/generated/flex/margin_auto_mutiple_children_row.rs index 7ff9941bd..14c154605 100644 --- a/tests/generated/flex/margin_auto_mutiple_children_row.rs +++ b/tests/generated/flex/margin_auto_mutiple_children_row.rs @@ -1,8 +1,8 @@ #[test] fn margin_auto_mutiple_children_row() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -55,9 +55,9 @@ fn margin_auto_mutiple_children_row() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/flex/margin_auto_right.rs b/tests/generated/flex/margin_auto_right.rs index a57e00da5..26a094990 100644 --- a/tests/generated/flex/margin_auto_right.rs +++ b/tests/generated/flex/margin_auto_right.rs @@ -1,8 +1,8 @@ #[test] fn margin_auto_right() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -40,9 +40,9 @@ fn margin_auto_right() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/flex/margin_auto_top.rs b/tests/generated/flex/margin_auto_top.rs index b3a9b78c5..79b689953 100644 --- a/tests/generated/flex/margin_auto_top.rs +++ b/tests/generated/flex/margin_auto_top.rs @@ -1,8 +1,8 @@ #[test] fn margin_auto_top() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -40,9 +40,9 @@ fn margin_auto_top() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/flex/margin_auto_top_and_bottom_stretch.rs b/tests/generated/flex/margin_auto_top_and_bottom_stretch.rs index 786c58960..4f1fceb51 100644 --- a/tests/generated/flex/margin_auto_top_and_bottom_stretch.rs +++ b/tests/generated/flex/margin_auto_top_and_bottom_stretch.rs @@ -1,8 +1,8 @@ #[test] fn margin_auto_top_and_bottom_stretch() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -41,9 +41,9 @@ fn margin_auto_top_and_bottom_stretch() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/flex/margin_auto_top_stretching_child.rs b/tests/generated/flex/margin_auto_top_stretching_child.rs index 4f9b4a4be..7fd8aa40d 100644 --- a/tests/generated/flex/margin_auto_top_stretching_child.rs +++ b/tests/generated/flex/margin_auto_top_stretching_child.rs @@ -1,8 +1,8 @@ #[test] fn margin_auto_top_stretching_child() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_grow: 1f32, @@ -39,9 +39,9 @@ fn margin_auto_top_stretching_child() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/flex/margin_bottom.rs b/tests/generated/flex/margin_bottom.rs index 79b9de164..40170ebd9 100644 --- a/tests/generated/flex/margin_bottom.rs +++ b/tests/generated/flex/margin_bottom.rs @@ -1,8 +1,8 @@ #[test] fn margin_bottom() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -29,9 +29,9 @@ fn margin_bottom() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/margin_fix_left_auto_right_child_bigger_than_parent.rs b/tests/generated/flex/margin_fix_left_auto_right_child_bigger_than_parent.rs index 546b1a1e2..147d8c218 100644 --- a/tests/generated/flex/margin_fix_left_auto_right_child_bigger_than_parent.rs +++ b/tests/generated/flex/margin_fix_left_auto_right_child_bigger_than_parent.rs @@ -1,8 +1,8 @@ #[test] fn margin_fix_left_auto_right_child_bigger_than_parent() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -31,9 +31,9 @@ fn margin_fix_left_auto_right_child_bigger_than_parent() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 52f32, "width of node {:?}. Expected {}. Actual {}", node, 52f32, size.width); diff --git a/tests/generated/flex/margin_left.rs b/tests/generated/flex/margin_left.rs index ccfa05ca8..c46d02ecc 100644 --- a/tests/generated/flex/margin_left.rs +++ b/tests/generated/flex/margin_left.rs @@ -1,8 +1,8 @@ #[test] fn margin_left() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Length(10f32), height: auto() }, @@ -27,9 +27,9 @@ fn margin_left() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/margin_right.rs b/tests/generated/flex/margin_right.rs index c8dc5e64c..f139c805c 100644 --- a/tests/generated/flex/margin_right.rs +++ b/tests/generated/flex/margin_right.rs @@ -1,8 +1,8 @@ #[test] fn margin_right() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Length(10f32), height: auto() }, @@ -28,9 +28,9 @@ fn margin_right() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/margin_should_not_be_part_of_max_height.rs b/tests/generated/flex/margin_should_not_be_part_of_max_height.rs index c53edf8b0..47c1a6440 100644 --- a/tests/generated/flex/margin_should_not_be_part_of_max_height.rs +++ b/tests/generated/flex/margin_should_not_be_part_of_max_height.rs @@ -1,8 +1,8 @@ #[test] fn margin_should_not_be_part_of_max_height() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -31,9 +31,9 @@ fn margin_should_not_be_part_of_max_height() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 250f32, "width of node {:?}. Expected {}. Actual {}", node, 250f32, size.width); diff --git a/tests/generated/flex/margin_should_not_be_part_of_max_width.rs b/tests/generated/flex/margin_should_not_be_part_of_max_width.rs index ccc296241..57f165129 100644 --- a/tests/generated/flex/margin_should_not_be_part_of_max_width.rs +++ b/tests/generated/flex/margin_should_not_be_part_of_max_width.rs @@ -1,8 +1,8 @@ #[test] fn margin_should_not_be_part_of_max_width() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -31,9 +31,9 @@ fn margin_should_not_be_part_of_max_width() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 250f32, "width of node {:?}. Expected {}. Actual {}", node, 250f32, size.width); diff --git a/tests/generated/flex/margin_top.rs b/tests/generated/flex/margin_top.rs index 87d73301b..2b84c4536 100644 --- a/tests/generated/flex/margin_top.rs +++ b/tests/generated/flex/margin_top.rs @@ -1,8 +1,8 @@ #[test] fn margin_top() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -28,9 +28,9 @@ fn margin_top() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/margin_with_sibling_column.rs b/tests/generated/flex/margin_with_sibling_column.rs index 633b11a19..7f8204c16 100644 --- a/tests/generated/flex/margin_with_sibling_column.rs +++ b/tests/generated/flex/margin_with_sibling_column.rs @@ -1,8 +1,8 @@ #[test] fn margin_with_sibling_column() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_grow: 1f32, @@ -29,9 +29,9 @@ fn margin_with_sibling_column() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/margin_with_sibling_row.rs b/tests/generated/flex/margin_with_sibling_row.rs index 3c5d6fc04..3765921de 100644 --- a/tests/generated/flex/margin_with_sibling_row.rs +++ b/tests/generated/flex/margin_with_sibling_row.rs @@ -1,8 +1,8 @@ #[test] fn margin_with_sibling_row() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_grow: 1f32, @@ -28,9 +28,9 @@ fn margin_with_sibling_row() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/max_height.rs b/tests/generated/flex/max_height.rs index 743930728..4b8de07d2 100644 --- a/tests/generated/flex/max_height.rs +++ b/tests/generated/flex/max_height.rs @@ -1,8 +1,8 @@ #[test] fn max_height() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Length(10f32), height: auto() }, @@ -22,9 +22,9 @@ fn max_height() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/max_height_overrides_height.rs b/tests/generated/flex/max_height_overrides_height.rs index 7c2120ce3..2eaf51acc 100644 --- a/tests/generated/flex/max_height_overrides_height.rs +++ b/tests/generated/flex/max_height_overrides_height.rs @@ -1,8 +1,8 @@ #[test] fn max_height_overrides_height() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(200f32) }, @@ -11,9 +11,9 @@ fn max_height_overrides_height() { }) .unwrap(); let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0]).unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); diff --git a/tests/generated/flex/max_height_overrides_height_on_root.rs b/tests/generated/flex/max_height_overrides_height_on_root.rs index 45c7166fa..79a9848ea 100644 --- a/tests/generated/flex/max_height_overrides_height_on_root.rs +++ b/tests/generated/flex/max_height_overrides_height_on_root.rs @@ -1,8 +1,8 @@ #[test] fn max_height_overrides_height_on_root() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(200f32) }, @@ -10,9 +10,9 @@ fn max_height_overrides_height_on_root() { ..Default::default() }) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); diff --git a/tests/generated/flex/max_width.rs b/tests/generated/flex/max_width.rs index 347da7fc9..acb9a80fc 100644 --- a/tests/generated/flex/max_width.rs +++ b/tests/generated/flex/max_width.rs @@ -1,8 +1,8 @@ #[test] fn max_width() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -23,9 +23,9 @@ fn max_width() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/max_width_overrides_width.rs b/tests/generated/flex/max_width_overrides_width.rs index 213df31b3..35be85891 100644 --- a/tests/generated/flex/max_width_overrides_width.rs +++ b/tests/generated/flex/max_width_overrides_width.rs @@ -1,8 +1,8 @@ #[test] fn max_width_overrides_width() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Length(200f32), height: auto() }, @@ -11,9 +11,9 @@ fn max_width_overrides_width() { }) .unwrap(); let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0]).unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/max_width_overrides_width_on_root.rs b/tests/generated/flex/max_width_overrides_width_on_root.rs index 2f0fe6a56..86800a0ff 100644 --- a/tests/generated/flex/max_width_overrides_width_on_root.rs +++ b/tests/generated/flex/max_width_overrides_width_on_root.rs @@ -1,8 +1,8 @@ #[test] fn max_width_overrides_width_on_root() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Length(200f32), height: auto() }, @@ -10,9 +10,9 @@ fn max_width_overrides_width_on_root() { ..Default::default() }) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/measure_child.rs b/tests/generated/flex/measure_child.rs index 8dc7d83ca..7c0c01905 100644 --- a/tests/generated/flex/measure_child.rs +++ b/tests/generated/flex/measure_child.rs @@ -1,27 +1,22 @@ #[test] fn measure_child() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HHHHHH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HHHHHH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0]).unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); diff --git a/tests/generated/flex/measure_child_absolute.rs b/tests/generated/flex/measure_child_absolute.rs index ea8d4e448..4d78a1f5f 100644 --- a/tests/generated/flex/measure_child_absolute.rs +++ b/tests/generated/flex/measure_child_absolute.rs @@ -1,21 +1,16 @@ #[test] fn measure_child_absolute() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { position: taffy::style::Position::Absolute, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HHHHHH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HHHHHH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -30,9 +25,9 @@ fn measure_child_absolute() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/measure_child_constraint.rs b/tests/generated/flex/measure_child_constraint.rs index e95515b01..52dfcea4e 100644 --- a/tests/generated/flex/measure_child_constraint.rs +++ b/tests/generated/flex/measure_child_constraint.rs @@ -1,9 +1,9 @@ #[test] fn measure_child_constraint() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); - let node0 = taffy . new_leaf_with_measure (taffy :: style :: Style { .. Default :: default () } , taffy :: tree :: MeasureFunc :: Raw (| known_dimensions , available_space | { const TEXT : & str = "HHHHHHHHHH\u{200b}HHHHHHHHHH\u{200b}HHHHHHHHHH\u{200b}HHHHHHHHHH\u{200b}HHHHHHHHHH\u{200b}HHHHHHHHHH\u{200b}HHHHHHHHHH\u{200b}HHHHHHHHHH\u{200b}HHHHHHHHHH\u{200b}HHHHHHHHHH" ; crate :: measure_standard_text (known_dimensions , available_space , TEXT , crate :: WritingMode :: Horizontal , None) }) ,) . unwrap () ; + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); + let node0 = taffy . new_leaf_with_context (taffy :: style :: Style { .. Default :: default () } , crate :: TextMeasure { text_content : "HHHHHHHHHH\u{200b}HHHHHHHHHH\u{200b}HHHHHHHHHH\u{200b}HHHHHHHHHH\u{200b}HHHHHHHHHH\u{200b}HHHHHHHHHH\u{200b}HHHHHHHHHH\u{200b}HHHHHHHHHH\u{200b}HHHHHHHHHH\u{200b}HHHHHHHHHH" , writing_mode : crate :: WritingMode :: Horizontal , _aspect_ratio : None , } ,) . unwrap () ; let node = taffy .new_with_children( taffy::style::Style { @@ -16,9 +16,9 @@ fn measure_child_constraint() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/flex/measure_child_constraint_padding_parent.rs b/tests/generated/flex/measure_child_constraint_padding_parent.rs index 521d4ca11..9c9601141 100644 --- a/tests/generated/flex/measure_child_constraint_padding_parent.rs +++ b/tests/generated/flex/measure_child_constraint_padding_parent.rs @@ -1,9 +1,9 @@ #[test] fn measure_child_constraint_padding_parent() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); - let node0 = taffy . new_leaf_with_measure (taffy :: style :: Style { .. Default :: default () } , taffy :: tree :: MeasureFunc :: Raw (| known_dimensions , available_space | { const TEXT : & str = "HHHHHHHHHH\u{200b}HHHHHHHHHH\u{200b}HHHHHHHHHH\u{200b}HHHHHHHHHH\u{200b}HHHHHHHHHH\u{200b}HHHHHHHHHH\u{200b}HHHHHHHHHH\u{200b}HHHHHHHHHH\u{200b}HHHHHHHHHH\u{200b}HHHHHHHHHH" ; crate :: measure_standard_text (known_dimensions , available_space , TEXT , crate :: WritingMode :: Horizontal , None) }) ,) . unwrap () ; + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); + let node0 = taffy . new_leaf_with_context (taffy :: style :: Style { .. Default :: default () } , crate :: TextMeasure { text_content : "HHHHHHHHHH\u{200b}HHHHHHHHHH\u{200b}HHHHHHHHHH\u{200b}HHHHHHHHHH\u{200b}HHHHHHHHHH\u{200b}HHHHHHHHHH\u{200b}HHHHHHHHHH\u{200b}HHHHHHHHHH\u{200b}HHHHHHHHHH\u{200b}HHHHHHHHHH" , writing_mode : crate :: WritingMode :: Horizontal , _aspect_ratio : None , } ,) . unwrap () ; let node = taffy .new_with_children( taffy::style::Style { @@ -22,9 +22,9 @@ fn measure_child_constraint_padding_parent() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/flex/measure_child_with_flex_grow.rs b/tests/generated/flex/measure_child_with_flex_grow.rs index e232d0cf6..f878b141c 100644 --- a/tests/generated/flex/measure_child_with_flex_grow.rs +++ b/tests/generated/flex/measure_child_with_flex_grow.rs @@ -1,8 +1,8 @@ #[test] fn measure_child_with_flex_grow() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -13,18 +13,13 @@ fn measure_child_with_flex_grow() { }) .unwrap(); let node1 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "H\u{200b}H\u{200b}H\u{200b}H\u{200b}H"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "H\u{200b}H\u{200b}H\u{200b}H\u{200b}H", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -39,9 +34,9 @@ fn measure_child_with_flex_grow() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/measure_child_with_flex_shrink.rs b/tests/generated/flex/measure_child_with_flex_shrink.rs index 828413576..06b2e648c 100644 --- a/tests/generated/flex/measure_child_with_flex_shrink.rs +++ b/tests/generated/flex/measure_child_with_flex_shrink.rs @@ -1,8 +1,8 @@ #[test] fn measure_child_with_flex_shrink() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -13,18 +13,13 @@ fn measure_child_with_flex_shrink() { }) .unwrap(); let node1 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HHHHHHHHHH\u{200b}HHHHHHHHHH\u{200b}HHHHHHHHHH\u{200b}HHHHHHHHHH\u{200b}HHHHHHHHHH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HHHHHHHHHH\u{200b}HHHHHHHHHH\u{200b}HHHHHHHHHH\u{200b}HHHHHHHHHH\u{200b}HHHHHHHHHH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -39,9 +34,9 @@ fn measure_child_with_flex_shrink() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/measure_child_with_flex_shrink_hidden.rs b/tests/generated/flex/measure_child_with_flex_shrink_hidden.rs index 6c4cb1afd..fc1e91369 100644 --- a/tests/generated/flex/measure_child_with_flex_shrink_hidden.rs +++ b/tests/generated/flex/measure_child_with_flex_shrink_hidden.rs @@ -1,8 +1,8 @@ #[test] fn measure_child_with_flex_shrink_hidden() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -13,7 +13,7 @@ fn measure_child_with_flex_shrink_hidden() { }) .unwrap(); let node1 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { overflow: taffy::geometry::Point { x: taffy::style::Overflow::Hidden, @@ -22,16 +22,11 @@ fn measure_child_with_flex_shrink_hidden() { scrollbar_width: 15f32, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HHHHHHHHHH\u{200b}HHHHHHHHHH\u{200b}HHHHHHHHHH\u{200b}HHHHHHHHHH\u{200b}HHHHHHHHHH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HHHHHHHHHH\u{200b}HHHHHHHHHH\u{200b}HHHHHHHHHH\u{200b}HHHHHHHHHH\u{200b}HHHHHHHHHH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -46,9 +41,9 @@ fn measure_child_with_flex_shrink_hidden() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/measure_child_with_min_size_greater_than_available_space.rs b/tests/generated/flex/measure_child_with_min_size_greater_than_available_space.rs index 9fc518bc4..aba74d1fe 100644 --- a/tests/generated/flex/measure_child_with_min_size_greater_than_available_space.rs +++ b/tests/generated/flex/measure_child_with_min_size_greater_than_available_space.rs @@ -1,24 +1,19 @@ #[test] fn measure_child_with_min_size_greater_than_available_space() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { min_size: taffy::geometry::Size { width: taffy::style::Dimension::Length(200f32), height: auto() }, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HHHHHHHH\u{200b}HHHHHHHH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HHHHHHHH\u{200b}HHHHHHHH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -32,9 +27,9 @@ fn measure_child_with_min_size_greater_than_available_space() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/measure_flex_basis_overrides_measure.rs b/tests/generated/flex/measure_flex_basis_overrides_measure.rs index b59b43488..e872f62d9 100644 --- a/tests/generated/flex/measure_flex_basis_overrides_measure.rs +++ b/tests/generated/flex/measure_flex_basis_overrides_measure.rs @@ -1,21 +1,12 @@ #[test] fn measure_flex_basis_overrides_measure() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "H"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { text_content: "H", writing_mode: crate::WritingMode::Horizontal, _aspect_ratio: None }, ) .unwrap(); let node = taffy @@ -30,9 +21,9 @@ fn measure_flex_basis_overrides_measure() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/flex/measure_height_overrides_measure.rs b/tests/generated/flex/measure_height_overrides_measure.rs index 5c3008c9f..698046c2e 100644 --- a/tests/generated/flex/measure_height_overrides_measure.rs +++ b/tests/generated/flex/measure_height_overrides_measure.rs @@ -1,30 +1,21 @@ #[test] fn measure_height_overrides_measure() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(5f32) }, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "H"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { text_content: "H", writing_mode: crate::WritingMode::Horizontal, _aspect_ratio: None }, ) .unwrap(); let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0]).unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node, 10f32, size.width); diff --git a/tests/generated/flex/measure_remeasure_child_after_growing.rs b/tests/generated/flex/measure_remeasure_child_after_growing.rs index 208b15dff..a721767a5 100644 --- a/tests/generated/flex/measure_remeasure_child_after_growing.rs +++ b/tests/generated/flex/measure_remeasure_child_after_growing.rs @@ -1,8 +1,8 @@ #[test] fn measure_remeasure_child_after_growing() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -13,18 +13,13 @@ fn measure_remeasure_child_after_growing() { }) .unwrap(); let node1 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -40,9 +35,9 @@ fn measure_remeasure_child_after_growing() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/measure_remeasure_child_after_shrinking.rs b/tests/generated/flex/measure_remeasure_child_after_shrinking.rs index 87770bbe3..44b7ae628 100644 --- a/tests/generated/flex/measure_remeasure_child_after_shrinking.rs +++ b/tests/generated/flex/measure_remeasure_child_after_shrinking.rs @@ -1,8 +1,8 @@ #[test] fn measure_remeasure_child_after_shrinking() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_shrink: 0f32, @@ -14,18 +14,13 @@ fn measure_remeasure_child_after_shrinking() { }) .unwrap(); let node1 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -41,9 +36,9 @@ fn measure_remeasure_child_after_shrinking() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/measure_remeasure_child_after_stretching.rs b/tests/generated/flex/measure_remeasure_child_after_stretching.rs index 094ef0805..e3d361ca7 100644 --- a/tests/generated/flex/measure_remeasure_child_after_stretching.rs +++ b/tests/generated/flex/measure_remeasure_child_after_stretching.rs @@ -1,21 +1,16 @@ #[test] fn measure_remeasure_child_after_stretching() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -30,9 +25,9 @@ fn measure_remeasure_child_after_stretching() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/measure_root.rs b/tests/generated/flex/measure_root.rs index ac257d3c7..129a9e5e7 100644 --- a/tests/generated/flex/measure_root.rs +++ b/tests/generated/flex/measure_root.rs @@ -1,26 +1,21 @@ #[test] fn measure_root() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HHHHHH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HHHHHH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); diff --git a/tests/generated/flex/measure_stretch_overrides_measure.rs b/tests/generated/flex/measure_stretch_overrides_measure.rs index 3d0a3c0f7..d58daec25 100644 --- a/tests/generated/flex/measure_stretch_overrides_measure.rs +++ b/tests/generated/flex/measure_stretch_overrides_measure.rs @@ -1,8 +1,8 @@ #[test] fn measure_stretch_overrides_measure() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_grow: 1f32, @@ -11,22 +11,13 @@ fn measure_stretch_overrides_measure() { }) .unwrap(); let node1 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { flex_grow: 1f32, flex_basis: taffy::style::Dimension::Length(5f32), ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "H"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { text_content: "H", writing_mode: crate::WritingMode::Horizontal, _aspect_ratio: None }, ) .unwrap(); let node = taffy @@ -41,9 +32,9 @@ fn measure_stretch_overrides_measure() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); diff --git a/tests/generated/flex/measure_width_overrides_measure.rs b/tests/generated/flex/measure_width_overrides_measure.rs index 9d185c32c..1c36d35f2 100644 --- a/tests/generated/flex/measure_width_overrides_measure.rs +++ b/tests/generated/flex/measure_width_overrides_measure.rs @@ -1,30 +1,25 @@ #[test] fn measure_width_overrides_measure() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Length(50f32), height: auto() }, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HHHHHHHHHH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HHHHHHHHHH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0]).unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/flex/min_height.rs b/tests/generated/flex/min_height.rs index 5b2f4d948..aa77d1b3c 100644 --- a/tests/generated/flex/min_height.rs +++ b/tests/generated/flex/min_height.rs @@ -1,8 +1,8 @@ #[test] fn min_height() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_grow: 1f32, @@ -24,9 +24,9 @@ fn min_height() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/min_height_larger_than_height.rs b/tests/generated/flex/min_height_larger_than_height.rs index 4a51b8a64..ebb097397 100644 --- a/tests/generated/flex/min_height_larger_than_height.rs +++ b/tests/generated/flex/min_height_larger_than_height.rs @@ -1,8 +1,8 @@ #[test] fn min_height_larger_than_height() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(25f32) }, @@ -22,9 +22,9 @@ fn min_height_larger_than_height() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/min_height_overrides_height.rs b/tests/generated/flex/min_height_overrides_height.rs index 65060b4d8..dcea95e2b 100644 --- a/tests/generated/flex/min_height_overrides_height.rs +++ b/tests/generated/flex/min_height_overrides_height.rs @@ -1,8 +1,8 @@ #[test] fn min_height_overrides_height() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(50f32) }, @@ -11,9 +11,9 @@ fn min_height_overrides_height() { }) .unwrap(); let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0]).unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); diff --git a/tests/generated/flex/min_height_overrides_height_on_root.rs b/tests/generated/flex/min_height_overrides_height_on_root.rs index f2a92537b..53ad5d820 100644 --- a/tests/generated/flex/min_height_overrides_height_on_root.rs +++ b/tests/generated/flex/min_height_overrides_height_on_root.rs @@ -1,8 +1,8 @@ #[test] fn min_height_overrides_height_on_root() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(50f32) }, @@ -10,9 +10,9 @@ fn min_height_overrides_height_on_root() { ..Default::default() }) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); diff --git a/tests/generated/flex/min_height_overrides_max_height.rs b/tests/generated/flex/min_height_overrides_max_height.rs index 9a16f2a7a..46a0a07ff 100644 --- a/tests/generated/flex/min_height_overrides_max_height.rs +++ b/tests/generated/flex/min_height_overrides_max_height.rs @@ -1,8 +1,8 @@ #[test] fn min_height_overrides_max_height() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(100f32) }, @@ -11,9 +11,9 @@ fn min_height_overrides_max_height() { }) .unwrap(); let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0]).unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); diff --git a/tests/generated/flex/min_height_with_nested_fixed_height.rs b/tests/generated/flex/min_height_with_nested_fixed_height.rs index dfda2503d..44611e807 100644 --- a/tests/generated/flex/min_height_with_nested_fixed_height.rs +++ b/tests/generated/flex/min_height_with_nested_fixed_height.rs @@ -1,8 +1,8 @@ #[test] fn min_height_with_nested_fixed_height() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -46,9 +46,9 @@ fn min_height_with_nested_fixed_height() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); diff --git a/tests/generated/flex/min_max_percent_different_width_height.rs b/tests/generated/flex/min_max_percent_different_width_height.rs index e783e9c01..db239b288 100644 --- a/tests/generated/flex/min_max_percent_different_width_height.rs +++ b/tests/generated/flex/min_max_percent_different_width_height.rs @@ -1,10 +1,10 @@ #[test] fn min_max_percent_different_width_height() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { min_size: taffy::geometry::Size { width: taffy::style::Dimension::Percent(0.1f32), @@ -16,16 +16,11 @@ fn min_max_percent_different_width_height() { }, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "\n "; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "\n ", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -42,9 +37,9 @@ fn min_max_percent_different_width_height() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/min_max_percent_no_width_height.rs b/tests/generated/flex/min_max_percent_no_width_height.rs index 220eeaf41..dce5bf288 100644 --- a/tests/generated/flex/min_max_percent_no_width_height.rs +++ b/tests/generated/flex/min_max_percent_no_width_height.rs @@ -1,8 +1,8 @@ #[test] fn min_max_percent_no_width_height() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { min_size: taffy::geometry::Size { @@ -30,9 +30,9 @@ fn min_max_percent_no_width_height() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/min_width.rs b/tests/generated/flex/min_width.rs index 58fa12bd2..985609b77 100644 --- a/tests/generated/flex/min_width.rs +++ b/tests/generated/flex/min_width.rs @@ -1,8 +1,8 @@ #[test] fn min_width() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_grow: 1f32, @@ -23,9 +23,9 @@ fn min_width() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/min_width_larger_than_width.rs b/tests/generated/flex/min_width_larger_than_width.rs index 11f4e29f0..2807ab192 100644 --- a/tests/generated/flex/min_width_larger_than_width.rs +++ b/tests/generated/flex/min_width_larger_than_width.rs @@ -1,8 +1,8 @@ #[test] fn min_width_larger_than_width() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Length(25f32), height: auto() }, @@ -23,9 +23,9 @@ fn min_width_larger_than_width() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/min_width_overrides_max_width.rs b/tests/generated/flex/min_width_overrides_max_width.rs index 2abe32e85..75f605a45 100644 --- a/tests/generated/flex/min_width_overrides_max_width.rs +++ b/tests/generated/flex/min_width_overrides_max_width.rs @@ -1,8 +1,8 @@ #[test] fn min_width_overrides_max_width() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { min_size: taffy::geometry::Size { width: taffy::style::Dimension::Length(100f32), height: auto() }, @@ -11,9 +11,9 @@ fn min_width_overrides_max_width() { }) .unwrap(); let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0]).unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/min_width_overrides_width.rs b/tests/generated/flex/min_width_overrides_width.rs index 1312f14f7..571029dae 100644 --- a/tests/generated/flex/min_width_overrides_width.rs +++ b/tests/generated/flex/min_width_overrides_width.rs @@ -1,8 +1,8 @@ #[test] fn min_width_overrides_width() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Length(50f32), height: auto() }, @@ -11,9 +11,9 @@ fn min_width_overrides_width() { }) .unwrap(); let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0]).unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/min_width_overrides_width_on_root.rs b/tests/generated/flex/min_width_overrides_width_on_root.rs index 2cc14915c..9c98676d7 100644 --- a/tests/generated/flex/min_width_overrides_width_on_root.rs +++ b/tests/generated/flex/min_width_overrides_width_on_root.rs @@ -1,8 +1,8 @@ #[test] fn min_width_overrides_width_on_root() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Length(50f32), height: auto() }, @@ -10,9 +10,9 @@ fn min_width_overrides_width_on_root() { ..Default::default() }) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/nested_overflowing_child.rs b/tests/generated/flex/nested_overflowing_child.rs index 6eb9664a3..3d2190d43 100644 --- a/tests/generated/flex/nested_overflowing_child.rs +++ b/tests/generated/flex/nested_overflowing_child.rs @@ -1,8 +1,8 @@ #[test] fn nested_overflowing_child() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -25,9 +25,9 @@ fn nested_overflowing_child() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/nested_overflowing_child_in_constraint_parent.rs b/tests/generated/flex/nested_overflowing_child_in_constraint_parent.rs index 5b80d4192..73803c7ac 100644 --- a/tests/generated/flex/nested_overflowing_child_in_constraint_parent.rs +++ b/tests/generated/flex/nested_overflowing_child_in_constraint_parent.rs @@ -1,8 +1,8 @@ #[test] fn nested_overflowing_child_in_constraint_parent() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -36,9 +36,9 @@ fn nested_overflowing_child_in_constraint_parent() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/only_shrinkable_item_with_flex_basis_zero.rs b/tests/generated/flex/only_shrinkable_item_with_flex_basis_zero.rs index e7828ef09..6b4ef8214 100644 --- a/tests/generated/flex/only_shrinkable_item_with_flex_basis_zero.rs +++ b/tests/generated/flex/only_shrinkable_item_with_flex_basis_zero.rs @@ -1,8 +1,8 @@ #[test] fn only_shrinkable_item_with_flex_basis_zero() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_shrink: 1f32, @@ -41,9 +41,9 @@ fn only_shrinkable_item_with_flex_basis_zero() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 480f32, "width of node {:?}. Expected {}. Actual {}", node, 480f32, size.width); diff --git a/tests/generated/flex/overflow_cross_axis.rs b/tests/generated/flex/overflow_cross_axis.rs index b6371d1df..c25e7417f 100644 --- a/tests/generated/flex/overflow_cross_axis.rs +++ b/tests/generated/flex/overflow_cross_axis.rs @@ -1,8 +1,8 @@ #[test] fn overflow_cross_axis() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -24,9 +24,9 @@ fn overflow_cross_axis() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/overflow_main_axis.rs b/tests/generated/flex/overflow_main_axis.rs index e86bfbec5..5cda8dbc2 100644 --- a/tests/generated/flex/overflow_main_axis.rs +++ b/tests/generated/flex/overflow_main_axis.rs @@ -1,8 +1,8 @@ #[test] fn overflow_main_axis() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_shrink: 0f32, @@ -22,9 +22,9 @@ fn overflow_main_axis() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/overflow_main_axis_shrink_hidden.rs b/tests/generated/flex/overflow_main_axis_shrink_hidden.rs index 5507df526..1775ceeac 100644 --- a/tests/generated/flex/overflow_main_axis_shrink_hidden.rs +++ b/tests/generated/flex/overflow_main_axis_shrink_hidden.rs @@ -1,10 +1,10 @@ #[test] fn overflow_main_axis_shrink_hidden() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { overflow: taffy::geometry::Point { x: taffy::style::Overflow::Hidden, @@ -14,16 +14,11 @@ fn overflow_main_axis_shrink_hidden() { flex_shrink: 1f32, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HHHHHHHHHH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HHHHHHHHHH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -38,9 +33,9 @@ fn overflow_main_axis_shrink_hidden() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/flex/overflow_main_axis_shrink_scroll.rs b/tests/generated/flex/overflow_main_axis_shrink_scroll.rs index a520b433b..e97d226d3 100644 --- a/tests/generated/flex/overflow_main_axis_shrink_scroll.rs +++ b/tests/generated/flex/overflow_main_axis_shrink_scroll.rs @@ -1,10 +1,10 @@ #[test] fn overflow_main_axis_shrink_scroll() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { overflow: taffy::geometry::Point { x: taffy::style::Overflow::Scroll, @@ -14,16 +14,11 @@ fn overflow_main_axis_shrink_scroll() { flex_shrink: 1f32, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HHHHHHHHHH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HHHHHHHHHH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -38,9 +33,9 @@ fn overflow_main_axis_shrink_scroll() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/flex/overflow_main_axis_shrink_visible.rs b/tests/generated/flex/overflow_main_axis_shrink_visible.rs index ad3db7ed5..0219651cd 100644 --- a/tests/generated/flex/overflow_main_axis_shrink_visible.rs +++ b/tests/generated/flex/overflow_main_axis_shrink_visible.rs @@ -1,21 +1,16 @@ #[test] fn overflow_main_axis_shrink_visible() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { flex_shrink: 1f32, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HHHHHHHHHH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HHHHHHHHHH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -30,9 +25,9 @@ fn overflow_main_axis_shrink_visible() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/flex/overflow_scroll_main_axis_justify_content_end.rs b/tests/generated/flex/overflow_scroll_main_axis_justify_content_end.rs index 15f1d18b4..627f154cb 100644 --- a/tests/generated/flex/overflow_scroll_main_axis_justify_content_end.rs +++ b/tests/generated/flex/overflow_scroll_main_axis_justify_content_end.rs @@ -1,8 +1,8 @@ #[test] fn overflow_scroll_main_axis_justify_content_end() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_shrink: 0f32, @@ -23,9 +23,9 @@ fn overflow_scroll_main_axis_justify_content_end() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/overflow_scrollbars_overriden_by_available_space.rs b/tests/generated/flex/overflow_scrollbars_overriden_by_available_space.rs index 2b7bf96a5..2ae72c366 100644 --- a/tests/generated/flex/overflow_scrollbars_overriden_by_available_space.rs +++ b/tests/generated/flex/overflow_scrollbars_overriden_by_available_space.rs @@ -1,8 +1,8 @@ #[test] fn overflow_scrollbars_overriden_by_available_space() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy.new_leaf(taffy::style::Style { flex_grow: 1f32, ..Default::default() }).unwrap(); let node0 = taffy .new_with_children( @@ -30,9 +30,9 @@ fn overflow_scrollbars_overriden_by_available_space() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node, 2f32, size.width); diff --git a/tests/generated/flex/overflow_scrollbars_overriden_by_max_size.rs b/tests/generated/flex/overflow_scrollbars_overriden_by_max_size.rs index c7491e1d9..fc29e0170 100644 --- a/tests/generated/flex/overflow_scrollbars_overriden_by_max_size.rs +++ b/tests/generated/flex/overflow_scrollbars_overriden_by_max_size.rs @@ -1,8 +1,8 @@ #[test] fn overflow_scrollbars_overriden_by_max_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { flex_grow: 1f32, ..Default::default() }).unwrap(); let node = taffy .new_with_children( @@ -21,9 +21,9 @@ fn overflow_scrollbars_overriden_by_max_size() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node, 2f32, size.width); diff --git a/tests/generated/flex/overflow_scrollbars_overriden_by_size.rs b/tests/generated/flex/overflow_scrollbars_overriden_by_size.rs index 8a4a87a76..ce19c8670 100644 --- a/tests/generated/flex/overflow_scrollbars_overriden_by_size.rs +++ b/tests/generated/flex/overflow_scrollbars_overriden_by_size.rs @@ -1,8 +1,8 @@ #[test] fn overflow_scrollbars_overriden_by_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { flex_grow: 1f32, ..Default::default() }).unwrap(); let node = taffy .new_with_children( @@ -21,9 +21,9 @@ fn overflow_scrollbars_overriden_by_size() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node, 2f32, size.width); diff --git a/tests/generated/flex/overflow_scrollbars_take_up_space_both_axis.rs b/tests/generated/flex/overflow_scrollbars_take_up_space_both_axis.rs index 77d656b1a..2bf45b8a1 100644 --- a/tests/generated/flex/overflow_scrollbars_take_up_space_both_axis.rs +++ b/tests/generated/flex/overflow_scrollbars_take_up_space_both_axis.rs @@ -1,8 +1,8 @@ #[test] fn overflow_scrollbars_take_up_space_both_axis() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { flex_grow: 1f32, ..Default::default() }).unwrap(); let node = taffy .new_with_children( @@ -21,9 +21,9 @@ fn overflow_scrollbars_take_up_space_both_axis() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/flex/overflow_scrollbars_take_up_space_cross_axis.rs b/tests/generated/flex/overflow_scrollbars_take_up_space_cross_axis.rs index 489fe1ff9..5cb0395bf 100644 --- a/tests/generated/flex/overflow_scrollbars_take_up_space_cross_axis.rs +++ b/tests/generated/flex/overflow_scrollbars_take_up_space_cross_axis.rs @@ -1,8 +1,8 @@ #[test] fn overflow_scrollbars_take_up_space_cross_axis() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { flex_grow: 1f32, ..Default::default() }).unwrap(); let node = taffy .new_with_children( @@ -21,9 +21,9 @@ fn overflow_scrollbars_take_up_space_cross_axis() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/flex/overflow_scrollbars_take_up_space_main_axis.rs b/tests/generated/flex/overflow_scrollbars_take_up_space_main_axis.rs index b8f6cda92..383fa870c 100644 --- a/tests/generated/flex/overflow_scrollbars_take_up_space_main_axis.rs +++ b/tests/generated/flex/overflow_scrollbars_take_up_space_main_axis.rs @@ -1,8 +1,8 @@ #[test] fn overflow_scrollbars_take_up_space_main_axis() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { flex_grow: 1f32, ..Default::default() }).unwrap(); let node = taffy .new_with_children( @@ -21,9 +21,9 @@ fn overflow_scrollbars_take_up_space_main_axis() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/flex/padding_align_end_child.rs b/tests/generated/flex/padding_align_end_child.rs index 813481041..f4b4dee3d 100644 --- a/tests/generated/flex/padding_align_end_child.rs +++ b/tests/generated/flex/padding_align_end_child.rs @@ -1,8 +1,8 @@ #[test] fn padding_align_end_child() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -32,9 +32,9 @@ fn padding_align_end_child() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/flex/padding_border_overrides_max_size.rs b/tests/generated/flex/padding_border_overrides_max_size.rs index 0bb77ea9a..b2c1884ad 100644 --- a/tests/generated/flex/padding_border_overrides_max_size.rs +++ b/tests/generated/flex/padding_border_overrides_max_size.rs @@ -1,8 +1,8 @@ #[test] fn padding_border_overrides_max_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { max_size: taffy::geometry::Size { @@ -25,9 +25,9 @@ fn padding_border_overrides_max_size() { }) .unwrap(); let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0]).unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node, 22f32, size.width); diff --git a/tests/generated/flex/padding_border_overrides_min_size.rs b/tests/generated/flex/padding_border_overrides_min_size.rs index df7d88d6c..0bceae3d7 100644 --- a/tests/generated/flex/padding_border_overrides_min_size.rs +++ b/tests/generated/flex/padding_border_overrides_min_size.rs @@ -1,8 +1,8 @@ #[test] fn padding_border_overrides_min_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { min_size: taffy::geometry::Size { @@ -25,9 +25,9 @@ fn padding_border_overrides_min_size() { }) .unwrap(); let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0]).unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node, 22f32, size.width); diff --git a/tests/generated/flex/padding_border_overrides_size.rs b/tests/generated/flex/padding_border_overrides_size.rs index c09efda08..6d1054743 100644 --- a/tests/generated/flex/padding_border_overrides_size.rs +++ b/tests/generated/flex/padding_border_overrides_size.rs @@ -1,8 +1,8 @@ #[test] fn padding_border_overrides_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -25,9 +25,9 @@ fn padding_border_overrides_size() { }) .unwrap(); let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0]).unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node, 22f32, size.width); diff --git a/tests/generated/flex/padding_border_overrides_size_flex_basis_0.rs b/tests/generated/flex/padding_border_overrides_size_flex_basis_0.rs index a1a3716de..148fc9f01 100644 --- a/tests/generated/flex/padding_border_overrides_size_flex_basis_0.rs +++ b/tests/generated/flex/padding_border_overrides_size_flex_basis_0.rs @@ -1,8 +1,8 @@ #[test] fn padding_border_overrides_size_flex_basis_0() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_basis: taffy::style::Dimension::Length(0f32), @@ -36,9 +36,9 @@ fn padding_border_overrides_size_flex_basis_0() { }) .unwrap(); let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0, node1]).unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 34f32, "width of node {:?}. Expected {}. Actual {}", node, 34f32, size.width); diff --git a/tests/generated/flex/padding_border_overrides_size_flex_basis_0_growable.rs b/tests/generated/flex/padding_border_overrides_size_flex_basis_0_growable.rs index 9c5f57ef8..40c4c4ac9 100644 --- a/tests/generated/flex/padding_border_overrides_size_flex_basis_0_growable.rs +++ b/tests/generated/flex/padding_border_overrides_size_flex_basis_0_growable.rs @@ -1,8 +1,8 @@ #[test] fn padding_border_overrides_size_flex_basis_0_growable() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_grow: 1f32, @@ -38,9 +38,9 @@ fn padding_border_overrides_size_flex_basis_0_growable() { }) .unwrap(); let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0, node1]).unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 34f32, "width of node {:?}. Expected {}. Actual {}", node, 34f32, size.width); diff --git a/tests/generated/flex/padding_center_child.rs b/tests/generated/flex/padding_center_child.rs index 18a389ae7..132fa2f76 100644 --- a/tests/generated/flex/padding_center_child.rs +++ b/tests/generated/flex/padding_center_child.rs @@ -1,8 +1,8 @@ #[test] fn padding_center_child() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -32,9 +32,9 @@ fn padding_center_child() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/padding_container_match_child.rs b/tests/generated/flex/padding_container_match_child.rs index 62da5ecfa..e99d59ef3 100644 --- a/tests/generated/flex/padding_container_match_child.rs +++ b/tests/generated/flex/padding_container_match_child.rs @@ -1,8 +1,8 @@ #[test] fn padding_container_match_child() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -27,9 +27,9 @@ fn padding_container_match_child() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node, 30f32, size.width); diff --git a/tests/generated/flex/padding_flex_child.rs b/tests/generated/flex/padding_flex_child.rs index 4b4ff0d6b..80d62aa14 100644 --- a/tests/generated/flex/padding_flex_child.rs +++ b/tests/generated/flex/padding_flex_child.rs @@ -1,8 +1,8 @@ #[test] fn padding_flex_child() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_grow: 1f32, @@ -28,9 +28,9 @@ fn padding_flex_child() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/padding_no_child.rs b/tests/generated/flex/padding_no_child.rs index b09a5101c..913eeaaa5 100644 --- a/tests/generated/flex/padding_no_child.rs +++ b/tests/generated/flex/padding_no_child.rs @@ -1,8 +1,8 @@ #[test] fn padding_no_child() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node = taffy .new_leaf(taffy::style::Style { padding: taffy::geometry::Rect { @@ -14,9 +14,9 @@ fn padding_no_child() { ..Default::default() }) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); diff --git a/tests/generated/flex/padding_no_size.rs b/tests/generated/flex/padding_no_size.rs index e790f019c..9a7a514a1 100644 --- a/tests/generated/flex/padding_no_size.rs +++ b/tests/generated/flex/padding_no_size.rs @@ -1,8 +1,8 @@ #[test] fn padding_no_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node = taffy .new_leaf(taffy::style::Style { padding: taffy::geometry::Rect { @@ -14,9 +14,9 @@ fn padding_no_size() { ..Default::default() }) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); diff --git a/tests/generated/flex/padding_stretch_child.rs b/tests/generated/flex/padding_stretch_child.rs index 7144f8e50..9d24fab6b 100644 --- a/tests/generated/flex/padding_stretch_child.rs +++ b/tests/generated/flex/padding_stretch_child.rs @@ -1,8 +1,8 @@ #[test] fn padding_stretch_child() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -27,9 +27,9 @@ fn padding_stretch_child() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/parent_wrap_child_size_overflowing_parent.rs b/tests/generated/flex/parent_wrap_child_size_overflowing_parent.rs index 33be1e58f..8272147d2 100644 --- a/tests/generated/flex/parent_wrap_child_size_overflowing_parent.rs +++ b/tests/generated/flex/parent_wrap_child_size_overflowing_parent.rs @@ -1,8 +1,8 @@ #[test] fn parent_wrap_child_size_overflowing_parent() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -33,9 +33,9 @@ fn parent_wrap_child_size_overflowing_parent() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/percent_absolute_position.rs b/tests/generated/flex/percent_absolute_position.rs index f151b30a9..07c0012fe 100644 --- a/tests/generated/flex/percent_absolute_position.rs +++ b/tests/generated/flex/percent_absolute_position.rs @@ -1,8 +1,8 @@ #[test] fn percent_absolute_position() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Percent(1f32), height: auto() }, @@ -47,9 +47,9 @@ fn percent_absolute_position() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); diff --git a/tests/generated/flex/percent_within_flex_grow.rs b/tests/generated/flex/percent_within_flex_grow.rs index 83d9e2cf3..3b0158487 100644 --- a/tests/generated/flex/percent_within_flex_grow.rs +++ b/tests/generated/flex/percent_within_flex_grow.rs @@ -1,8 +1,8 @@ #[test] fn percent_within_flex_grow() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Length(100f32), height: auto() }, @@ -43,9 +43,9 @@ fn percent_within_flex_grow() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 350f32, "width of node {:?}. Expected {}. Actual {}", node, 350f32, size.width); diff --git a/tests/generated/flex/percentage_absolute_position.rs b/tests/generated/flex/percentage_absolute_position.rs index aa0aa429d..d61cbdc97 100644 --- a/tests/generated/flex/percentage_absolute_position.rs +++ b/tests/generated/flex/percentage_absolute_position.rs @@ -1,8 +1,8 @@ #[test] fn percentage_absolute_position() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -32,9 +32,9 @@ fn percentage_absolute_position() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/flex/percentage_container_in_wrapping_container.rs b/tests/generated/flex/percentage_container_in_wrapping_container.rs index 026edf05b..bd39a154b 100644 --- a/tests/generated/flex/percentage_container_in_wrapping_container.rs +++ b/tests/generated/flex/percentage_container_in_wrapping_container.rs @@ -1,8 +1,8 @@ #[test] fn percentage_container_in_wrapping_container() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node000 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -52,9 +52,9 @@ fn percentage_container_in_wrapping_container() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/flex/percentage_different_width_height.rs b/tests/generated/flex/percentage_different_width_height.rs index e04c377d3..76e379bcb 100644 --- a/tests/generated/flex/percentage_different_width_height.rs +++ b/tests/generated/flex/percentage_different_width_height.rs @@ -1,8 +1,8 @@ #[test] fn percentage_different_width_height() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_grow: 1f32, @@ -28,9 +28,9 @@ fn percentage_different_width_height() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/flex/percentage_different_width_height_column.rs b/tests/generated/flex/percentage_different_width_height_column.rs index dbd0f9eeb..28ea1caf9 100644 --- a/tests/generated/flex/percentage_different_width_height_column.rs +++ b/tests/generated/flex/percentage_different_width_height_column.rs @@ -1,8 +1,8 @@ #[test] fn percentage_different_width_height_column() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { flex_grow: 1f32, ..Default::default() }).unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { @@ -23,9 +23,9 @@ fn percentage_different_width_height_column() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/flex/percentage_flex_basis.rs b/tests/generated/flex/percentage_flex_basis.rs index 86ed7e628..f085394f8 100644 --- a/tests/generated/flex/percentage_flex_basis.rs +++ b/tests/generated/flex/percentage_flex_basis.rs @@ -1,8 +1,8 @@ #[test] fn percentage_flex_basis() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_grow: 1f32, @@ -29,9 +29,9 @@ fn percentage_flex_basis() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/flex/percentage_flex_basis_cross.rs b/tests/generated/flex/percentage_flex_basis_cross.rs index 222b982a5..0edc5455b 100644 --- a/tests/generated/flex/percentage_flex_basis_cross.rs +++ b/tests/generated/flex/percentage_flex_basis_cross.rs @@ -1,8 +1,8 @@ #[test] fn percentage_flex_basis_cross() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_grow: 1f32, @@ -30,9 +30,9 @@ fn percentage_flex_basis_cross() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/flex/percentage_flex_basis_cross_max_height.rs b/tests/generated/flex/percentage_flex_basis_cross_max_height.rs index 35c18b103..6c23e38ea 100644 --- a/tests/generated/flex/percentage_flex_basis_cross_max_height.rs +++ b/tests/generated/flex/percentage_flex_basis_cross_max_height.rs @@ -1,8 +1,8 @@ #[test] fn percentage_flex_basis_cross_max_height() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_grow: 1f32, @@ -32,9 +32,9 @@ fn percentage_flex_basis_cross_max_height() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/flex/percentage_flex_basis_cross_max_width.rs b/tests/generated/flex/percentage_flex_basis_cross_max_width.rs index 9ac1171a6..9f739c41c 100644 --- a/tests/generated/flex/percentage_flex_basis_cross_max_width.rs +++ b/tests/generated/flex/percentage_flex_basis_cross_max_width.rs @@ -1,8 +1,8 @@ #[test] fn percentage_flex_basis_cross_max_width() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_grow: 1f32, @@ -32,9 +32,9 @@ fn percentage_flex_basis_cross_max_width() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/flex/percentage_flex_basis_cross_min_height.rs b/tests/generated/flex/percentage_flex_basis_cross_min_height.rs index 2746b3930..4a4eef8d2 100644 --- a/tests/generated/flex/percentage_flex_basis_cross_min_height.rs +++ b/tests/generated/flex/percentage_flex_basis_cross_min_height.rs @@ -1,8 +1,8 @@ #[test] fn percentage_flex_basis_cross_min_height() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_grow: 1f32, @@ -30,9 +30,9 @@ fn percentage_flex_basis_cross_min_height() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/flex/percentage_flex_basis_cross_min_width.rs b/tests/generated/flex/percentage_flex_basis_cross_min_width.rs index 30e3a1959..a038601ff 100644 --- a/tests/generated/flex/percentage_flex_basis_cross_min_width.rs +++ b/tests/generated/flex/percentage_flex_basis_cross_min_width.rs @@ -1,8 +1,8 @@ #[test] fn percentage_flex_basis_cross_min_width() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_grow: 1f32, @@ -32,9 +32,9 @@ fn percentage_flex_basis_cross_min_width() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/flex/percentage_flex_basis_main_max_height.rs b/tests/generated/flex/percentage_flex_basis_main_max_height.rs index 45b7d2ca8..5c07f7ed1 100644 --- a/tests/generated/flex/percentage_flex_basis_main_max_height.rs +++ b/tests/generated/flex/percentage_flex_basis_main_max_height.rs @@ -1,8 +1,8 @@ #[test] fn percentage_flex_basis_main_max_height() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_grow: 1f32, @@ -31,9 +31,9 @@ fn percentage_flex_basis_main_max_height() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/flex/percentage_flex_basis_main_max_width.rs b/tests/generated/flex/percentage_flex_basis_main_max_width.rs index dd5a57342..72e074e9a 100644 --- a/tests/generated/flex/percentage_flex_basis_main_max_width.rs +++ b/tests/generated/flex/percentage_flex_basis_main_max_width.rs @@ -1,8 +1,8 @@ #[test] fn percentage_flex_basis_main_max_width() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_grow: 1f32, @@ -31,9 +31,9 @@ fn percentage_flex_basis_main_max_width() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/flex/percentage_flex_basis_main_min_width.rs b/tests/generated/flex/percentage_flex_basis_main_min_width.rs index 0c390587a..e22e0029e 100644 --- a/tests/generated/flex/percentage_flex_basis_main_min_width.rs +++ b/tests/generated/flex/percentage_flex_basis_main_min_width.rs @@ -1,8 +1,8 @@ #[test] fn percentage_flex_basis_main_min_width() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_grow: 1f32, @@ -31,9 +31,9 @@ fn percentage_flex_basis_main_min_width() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/flex/percentage_main_max_height.rs b/tests/generated/flex/percentage_main_max_height.rs index 04cc31f0b..dd3446080 100644 --- a/tests/generated/flex/percentage_main_max_height.rs +++ b/tests/generated/flex/percentage_main_max_height.rs @@ -1,8 +1,8 @@ #[test] fn percentage_main_max_height() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { flex_basis: taffy::style::Dimension::Length(15f32), ..Default::default() }) .unwrap(); @@ -34,9 +34,9 @@ fn percentage_main_max_height() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 71f32, "width of node {:?}. Expected {}. Actual {}", node, 71f32, size.width); diff --git a/tests/generated/flex/percentage_margin_should_calculate_based_only_on_width.rs b/tests/generated/flex/percentage_margin_should_calculate_based_only_on_width.rs index 2f5e7b3ef..b5c35bc8a 100644 --- a/tests/generated/flex/percentage_margin_should_calculate_based_only_on_width.rs +++ b/tests/generated/flex/percentage_margin_should_calculate_based_only_on_width.rs @@ -1,8 +1,8 @@ #[test] fn percentage_margin_should_calculate_based_only_on_width() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -41,9 +41,9 @@ fn percentage_margin_should_calculate_based_only_on_width() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/flex/percentage_moderate_complexity.rs b/tests/generated/flex/percentage_moderate_complexity.rs index 6205a306c..babef226a 100644 --- a/tests/generated/flex/percentage_moderate_complexity.rs +++ b/tests/generated/flex/percentage_moderate_complexity.rs @@ -1,8 +1,8 @@ #[test] fn percentage_moderate_complexity() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); taffy.disable_rounding(); let node00 = taffy .new_leaf(taffy::style::Style { @@ -62,9 +62,9 @@ fn percentage_moderate_complexity() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert!(size.width - 200f32 < 0.1, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/flex/percentage_moderate_complexity2.rs b/tests/generated/flex/percentage_moderate_complexity2.rs index 99507f382..a2c445920 100644 --- a/tests/generated/flex/percentage_moderate_complexity2.rs +++ b/tests/generated/flex/percentage_moderate_complexity2.rs @@ -1,8 +1,8 @@ #[test] fn percentage_moderate_complexity2() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -41,9 +41,9 @@ fn percentage_moderate_complexity2() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/flex/percentage_multiple_nested_with_padding_margin_and_percentage_values.rs b/tests/generated/flex/percentage_multiple_nested_with_padding_margin_and_percentage_values.rs index 5670b4c49..a278653ba 100644 --- a/tests/generated/flex/percentage_multiple_nested_with_padding_margin_and_percentage_values.rs +++ b/tests/generated/flex/percentage_multiple_nested_with_padding_margin_and_percentage_values.rs @@ -1,8 +1,8 @@ #[test] fn percentage_multiple_nested_with_padding_margin_and_percentage_values() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node000 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Percent(0.45f32), height: auto() }, @@ -88,9 +88,9 @@ fn percentage_multiple_nested_with_padding_margin_and_percentage_values() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/flex/percentage_padding_should_calculate_based_only_on_width.rs b/tests/generated/flex/percentage_padding_should_calculate_based_only_on_width.rs index dc349c6e0..83f71fff7 100644 --- a/tests/generated/flex/percentage_padding_should_calculate_based_only_on_width.rs +++ b/tests/generated/flex/percentage_padding_should_calculate_based_only_on_width.rs @@ -1,8 +1,8 @@ #[test] fn percentage_padding_should_calculate_based_only_on_width() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -41,9 +41,9 @@ fn percentage_padding_should_calculate_based_only_on_width() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/flex/percentage_position_bottom_right.rs b/tests/generated/flex/percentage_position_bottom_right.rs index a9d03ce90..4c0c39964 100644 --- a/tests/generated/flex/percentage_position_bottom_right.rs +++ b/tests/generated/flex/percentage_position_bottom_right.rs @@ -1,8 +1,8 @@ #[test] fn percentage_position_bottom_right() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -30,9 +30,9 @@ fn percentage_position_bottom_right() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 500f32, "width of node {:?}. Expected {}. Actual {}", node, 500f32, size.width); diff --git a/tests/generated/flex/percentage_position_left_top.rs b/tests/generated/flex/percentage_position_left_top.rs index 7349ff755..aa69b1e7f 100644 --- a/tests/generated/flex/percentage_position_left_top.rs +++ b/tests/generated/flex/percentage_position_left_top.rs @@ -1,8 +1,8 @@ #[test] fn percentage_position_left_top() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -30,9 +30,9 @@ fn percentage_position_left_top() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); diff --git a/tests/generated/flex/percentage_size_based_on_parent_inner_size.rs b/tests/generated/flex/percentage_size_based_on_parent_inner_size.rs index f303ae2ef..e7fe434a2 100644 --- a/tests/generated/flex/percentage_size_based_on_parent_inner_size.rs +++ b/tests/generated/flex/percentage_size_based_on_parent_inner_size.rs @@ -1,8 +1,8 @@ #[test] fn percentage_size_based_on_parent_inner_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -31,9 +31,9 @@ fn percentage_size_based_on_parent_inner_size() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/flex/percentage_size_of_flex_basis.rs b/tests/generated/flex/percentage_size_of_flex_basis.rs index 36c0279b9..077d44232 100644 --- a/tests/generated/flex/percentage_size_of_flex_basis.rs +++ b/tests/generated/flex/percentage_size_of_flex_basis.rs @@ -1,8 +1,8 @@ #[test] fn percentage_size_of_flex_basis() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -27,9 +27,9 @@ fn percentage_size_of_flex_basis() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/percentage_sizes_should_not_prevent_flex_shrinking.rs b/tests/generated/flex/percentage_sizes_should_not_prevent_flex_shrinking.rs index ab05d9ef6..06dd7e4f7 100644 --- a/tests/generated/flex/percentage_sizes_should_not_prevent_flex_shrinking.rs +++ b/tests/generated/flex/percentage_sizes_should_not_prevent_flex_shrinking.rs @@ -1,8 +1,8 @@ #[test] fn percentage_sizes_should_not_prevent_flex_shrinking() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node0 = taffy .new_with_children( @@ -25,9 +25,9 @@ fn percentage_sizes_should_not_prevent_flex_shrinking() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/flex/percentage_width_height.rs b/tests/generated/flex/percentage_width_height.rs index 92e2d3879..39aa6c3e6 100644 --- a/tests/generated/flex/percentage_width_height.rs +++ b/tests/generated/flex/percentage_width_height.rs @@ -1,8 +1,8 @@ #[test] fn percentage_width_height() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -24,9 +24,9 @@ fn percentage_width_height() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/flex/percentage_width_height_undefined_parent_size.rs b/tests/generated/flex/percentage_width_height_undefined_parent_size.rs index 837f5a3f0..32d43b198 100644 --- a/tests/generated/flex/percentage_width_height_undefined_parent_size.rs +++ b/tests/generated/flex/percentage_width_height_undefined_parent_size.rs @@ -1,8 +1,8 @@ #[test] fn percentage_width_height_undefined_parent_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -18,9 +18,9 @@ fn percentage_width_height_undefined_parent_size() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); diff --git a/tests/generated/flex/position_root_with_rtl_should_position_withoutdirection.rs b/tests/generated/flex/position_root_with_rtl_should_position_withoutdirection.rs index c5d957eea..de1452f21 100644 --- a/tests/generated/flex/position_root_with_rtl_should_position_withoutdirection.rs +++ b/tests/generated/flex/position_root_with_rtl_should_position_withoutdirection.rs @@ -1,8 +1,8 @@ #[test] fn position_root_with_rtl_should_position_withoutdirection() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -19,9 +19,9 @@ fn position_root_with_rtl_should_position_withoutdirection() { }) .unwrap(); let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0]).unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 52f32, "width of node {:?}. Expected {}. Actual {}", node, 52f32, size.width); diff --git a/tests/generated/flex/relative_position_should_not_nudge_siblings.rs b/tests/generated/flex/relative_position_should_not_nudge_siblings.rs index c0cfe1095..9c434d96d 100644 --- a/tests/generated/flex/relative_position_should_not_nudge_siblings.rs +++ b/tests/generated/flex/relative_position_should_not_nudge_siblings.rs @@ -1,8 +1,8 @@ #[test] fn relative_position_should_not_nudge_siblings() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(10f32) }, @@ -40,9 +40,9 @@ fn relative_position_should_not_nudge_siblings() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/rounding_flex_basis_flex_grow_row_prime_number_width.rs b/tests/generated/flex/rounding_flex_basis_flex_grow_row_prime_number_width.rs index 4e6056643..c1b3a10e2 100644 --- a/tests/generated/flex/rounding_flex_basis_flex_grow_row_prime_number_width.rs +++ b/tests/generated/flex/rounding_flex_basis_flex_grow_row_prime_number_width.rs @@ -1,8 +1,8 @@ #[test] fn rounding_flex_basis_flex_grow_row_prime_number_width() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { flex_grow: 1f32, ..Default::default() }).unwrap(); let node1 = taffy.new_leaf(taffy::style::Style { flex_grow: 1f32, ..Default::default() }).unwrap(); let node2 = taffy.new_leaf(taffy::style::Style { flex_grow: 1f32, ..Default::default() }).unwrap(); @@ -20,9 +20,9 @@ fn rounding_flex_basis_flex_grow_row_prime_number_width() { &[node0, node1, node2, node3, node4], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 113f32, "width of node {:?}. Expected {}. Actual {}", node, 113f32, size.width); diff --git a/tests/generated/flex/rounding_flex_basis_flex_grow_row_width_of_100.rs b/tests/generated/flex/rounding_flex_basis_flex_grow_row_width_of_100.rs index ee9a28c81..c5d7833a3 100644 --- a/tests/generated/flex/rounding_flex_basis_flex_grow_row_width_of_100.rs +++ b/tests/generated/flex/rounding_flex_basis_flex_grow_row_width_of_100.rs @@ -1,8 +1,8 @@ #[test] fn rounding_flex_basis_flex_grow_row_width_of_100() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { flex_grow: 1f32, ..Default::default() }).unwrap(); let node1 = taffy.new_leaf(taffy::style::Style { flex_grow: 1f32, ..Default::default() }).unwrap(); let node2 = taffy.new_leaf(taffy::style::Style { flex_grow: 1f32, ..Default::default() }).unwrap(); @@ -18,9 +18,9 @@ fn rounding_flex_basis_flex_grow_row_width_of_100() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/rounding_flex_basis_flex_shrink_row.rs b/tests/generated/flex/rounding_flex_basis_flex_shrink_row.rs index bc5b58634..0a74fd20b 100644 --- a/tests/generated/flex/rounding_flex_basis_flex_shrink_row.rs +++ b/tests/generated/flex/rounding_flex_basis_flex_shrink_row.rs @@ -1,8 +1,8 @@ #[test] fn rounding_flex_basis_flex_shrink_row() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_shrink: 1f32, @@ -28,9 +28,9 @@ fn rounding_flex_basis_flex_shrink_row() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 101f32, "width of node {:?}. Expected {}. Actual {}", node, 101f32, size.width); diff --git a/tests/generated/flex/rounding_flex_basis_overrides_main_size.rs b/tests/generated/flex/rounding_flex_basis_overrides_main_size.rs index 3e0af8e7b..b510605f8 100644 --- a/tests/generated/flex/rounding_flex_basis_overrides_main_size.rs +++ b/tests/generated/flex/rounding_flex_basis_overrides_main_size.rs @@ -1,8 +1,8 @@ #[test] fn rounding_flex_basis_overrides_main_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_grow: 1f32, @@ -38,9 +38,9 @@ fn rounding_flex_basis_overrides_main_size() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/rounding_fractial_input_1.rs b/tests/generated/flex/rounding_fractial_input_1.rs index b04814083..b576f1046 100644 --- a/tests/generated/flex/rounding_fractial_input_1.rs +++ b/tests/generated/flex/rounding_fractial_input_1.rs @@ -1,8 +1,8 @@ #[test] fn rounding_fractial_input_1() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_grow: 1f32, @@ -38,9 +38,9 @@ fn rounding_fractial_input_1() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/rounding_fractial_input_2.rs b/tests/generated/flex/rounding_fractial_input_2.rs index f21429ce3..f916b4411 100644 --- a/tests/generated/flex/rounding_fractial_input_2.rs +++ b/tests/generated/flex/rounding_fractial_input_2.rs @@ -1,8 +1,8 @@ #[test] fn rounding_fractial_input_2() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_grow: 1f32, @@ -38,9 +38,9 @@ fn rounding_fractial_input_2() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/rounding_fractial_input_3.rs b/tests/generated/flex/rounding_fractial_input_3.rs index 9acb9fc46..cfb7fc32b 100644 --- a/tests/generated/flex/rounding_fractial_input_3.rs +++ b/tests/generated/flex/rounding_fractial_input_3.rs @@ -1,8 +1,8 @@ #[test] fn rounding_fractial_input_3() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_grow: 1f32, @@ -38,9 +38,9 @@ fn rounding_fractial_input_3() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/rounding_fractial_input_4.rs b/tests/generated/flex/rounding_fractial_input_4.rs index e3e11cc46..ee423bf31 100644 --- a/tests/generated/flex/rounding_fractial_input_4.rs +++ b/tests/generated/flex/rounding_fractial_input_4.rs @@ -1,8 +1,8 @@ #[test] fn rounding_fractial_input_4() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_grow: 1f32, @@ -38,9 +38,9 @@ fn rounding_fractial_input_4() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/rounding_fractial_input_5.rs b/tests/generated/flex/rounding_fractial_input_5.rs index e118464ea..17a46db14 100644 --- a/tests/generated/flex/rounding_fractial_input_5.rs +++ b/tests/generated/flex/rounding_fractial_input_5.rs @@ -1,8 +1,8 @@ #[test] fn rounding_fractial_input_5() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -34,9 +34,9 @@ fn rounding_fractial_input_5() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 963f32, "width of node {:?}. Expected {}. Actual {}", node, 963f32, size.width); diff --git a/tests/generated/flex/rounding_fractial_input_6.rs b/tests/generated/flex/rounding_fractial_input_6.rs index c90401478..fe1742e02 100644 --- a/tests/generated/flex/rounding_fractial_input_6.rs +++ b/tests/generated/flex/rounding_fractial_input_6.rs @@ -1,8 +1,8 @@ #[test] fn rounding_fractial_input_6() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -68,9 +68,9 @@ fn rounding_fractial_input_6() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 7f32, "width of node {:?}. Expected {}. Actual {}", node, 7f32, size.width); diff --git a/tests/generated/flex/rounding_fractial_input_7.rs b/tests/generated/flex/rounding_fractial_input_7.rs index 4b3140d5b..cd69e8254 100644 --- a/tests/generated/flex/rounding_fractial_input_7.rs +++ b/tests/generated/flex/rounding_fractial_input_7.rs @@ -1,8 +1,8 @@ #[test] fn rounding_fractial_input_7() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -124,9 +124,9 @@ fn rounding_fractial_input_7() { &[node0, node1, node2, node3], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 7f32, "width of node {:?}. Expected {}. Actual {}", node, 7f32, size.width); diff --git a/tests/generated/flex/rounding_inner_node_controversy_combined.rs b/tests/generated/flex/rounding_inner_node_controversy_combined.rs index 6be097017..a9f78c868 100644 --- a/tests/generated/flex/rounding_inner_node_controversy_combined.rs +++ b/tests/generated/flex/rounding_inner_node_controversy_combined.rs @@ -1,8 +1,8 @@ #[test] fn rounding_inner_node_controversy_combined() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_grow: 1f32, @@ -72,9 +72,9 @@ fn rounding_inner_node_controversy_combined() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 640f32, "width of node {:?}. Expected {}. Actual {}", node, 640f32, size.width); diff --git a/tests/generated/flex/rounding_inner_node_controversy_horizontal.rs b/tests/generated/flex/rounding_inner_node_controversy_horizontal.rs index e9c2dda06..b57baba17 100644 --- a/tests/generated/flex/rounding_inner_node_controversy_horizontal.rs +++ b/tests/generated/flex/rounding_inner_node_controversy_horizontal.rs @@ -1,8 +1,8 @@ #[test] fn rounding_inner_node_controversy_horizontal() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_grow: 1f32, @@ -44,9 +44,9 @@ fn rounding_inner_node_controversy_horizontal() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); diff --git a/tests/generated/flex/rounding_inner_node_controversy_vertical.rs b/tests/generated/flex/rounding_inner_node_controversy_vertical.rs index 518de5174..5da4d20ef 100644 --- a/tests/generated/flex/rounding_inner_node_controversy_vertical.rs +++ b/tests/generated/flex/rounding_inner_node_controversy_vertical.rs @@ -1,8 +1,8 @@ #[test] fn rounding_inner_node_controversy_vertical() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_grow: 1f32, @@ -45,9 +45,9 @@ fn rounding_inner_node_controversy_vertical() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node, 10f32, size.width); diff --git a/tests/generated/flex/rounding_total_fractial.rs b/tests/generated/flex/rounding_total_fractial.rs index a7d299cbf..b540217d2 100644 --- a/tests/generated/flex/rounding_total_fractial.rs +++ b/tests/generated/flex/rounding_total_fractial.rs @@ -1,8 +1,8 @@ #[test] fn rounding_total_fractial() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_grow: 0.7f32, @@ -38,9 +38,9 @@ fn rounding_total_fractial() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 87f32, "width of node {:?}. Expected {}. Actual {}", node, 87f32, size.width); diff --git a/tests/generated/flex/rounding_total_fractial_nested.rs b/tests/generated/flex/rounding_total_fractial_nested.rs index 027195c93..48436408f 100644 --- a/tests/generated/flex/rounding_total_fractial_nested.rs +++ b/tests/generated/flex/rounding_total_fractial_nested.rs @@ -1,8 +1,8 @@ #[test] fn rounding_total_fractial_nested() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { flex_grow: 1f32, @@ -70,9 +70,9 @@ fn rounding_total_fractial_nested() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 87f32, "width of node {:?}. Expected {}. Actual {}", node, 87f32, size.width); diff --git a/tests/generated/flex/simple_child.rs b/tests/generated/flex/simple_child.rs index a27a91c8a..a631baa89 100644 --- a/tests/generated/flex/simple_child.rs +++ b/tests/generated/flex/simple_child.rs @@ -1,8 +1,8 @@ #[test] fn simple_child() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node000 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -69,9 +69,9 @@ fn simple_child() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/single_flex_child_after_absolute_child.rs b/tests/generated/flex/single_flex_child_after_absolute_child.rs index 10193a5ac..34cb36ed2 100644 --- a/tests/generated/flex/single_flex_child_after_absolute_child.rs +++ b/tests/generated/flex/single_flex_child_after_absolute_child.rs @@ -1,8 +1,8 @@ #[test] fn single_flex_child_after_absolute_child() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -35,9 +35,9 @@ fn single_flex_child_after_absolute_child() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 428f32, "width of node {:?}. Expected {}. Actual {}", node, 428f32, size.width); diff --git a/tests/generated/flex/size_defined_by_child.rs b/tests/generated/flex/size_defined_by_child.rs index 5113f358a..dc70e4739 100644 --- a/tests/generated/flex/size_defined_by_child.rs +++ b/tests/generated/flex/size_defined_by_child.rs @@ -1,8 +1,8 @@ #[test] fn size_defined_by_child() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -13,9 +13,9 @@ fn size_defined_by_child() { }) .unwrap(); let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0]).unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/size_defined_by_child_with_border.rs b/tests/generated/flex/size_defined_by_child_with_border.rs index 4f978bb9e..ce33b78ba 100644 --- a/tests/generated/flex/size_defined_by_child_with_border.rs +++ b/tests/generated/flex/size_defined_by_child_with_border.rs @@ -1,8 +1,8 @@ #[test] fn size_defined_by_child_with_border() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -26,9 +26,9 @@ fn size_defined_by_child_with_border() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node, 30f32, size.width); diff --git a/tests/generated/flex/size_defined_by_child_with_padding.rs b/tests/generated/flex/size_defined_by_child_with_padding.rs index b1dbc55a0..811dffbe8 100644 --- a/tests/generated/flex/size_defined_by_child_with_padding.rs +++ b/tests/generated/flex/size_defined_by_child_with_padding.rs @@ -1,8 +1,8 @@ #[test] fn size_defined_by_child_with_padding() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -26,9 +26,9 @@ fn size_defined_by_child_with_padding() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node, 30f32, size.width); diff --git a/tests/generated/flex/size_defined_by_grand_child.rs b/tests/generated/flex/size_defined_by_grand_child.rs index 7ef97dfbb..66218180e 100644 --- a/tests/generated/flex/size_defined_by_grand_child.rs +++ b/tests/generated/flex/size_defined_by_grand_child.rs @@ -1,8 +1,8 @@ #[test] fn size_defined_by_grand_child() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -14,9 +14,9 @@ fn size_defined_by_grand_child() { .unwrap(); let node0 = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node00]).unwrap(); let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0]).unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/undefined_height_with_min_max.rs b/tests/generated/flex/undefined_height_with_min_max.rs index bd535d40b..dba0b9ea7 100644 --- a/tests/generated/flex/undefined_height_with_min_max.rs +++ b/tests/generated/flex/undefined_height_with_min_max.rs @@ -1,8 +1,8 @@ #[test] fn undefined_height_with_min_max() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(0f32) }, @@ -21,9 +21,9 @@ fn undefined_height_with_min_max() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); diff --git a/tests/generated/flex/undefined_width_with_min_max.rs b/tests/generated/flex/undefined_width_with_min_max.rs index d513e0918..7fd3580b8 100644 --- a/tests/generated/flex/undefined_width_with_min_max.rs +++ b/tests/generated/flex/undefined_width_with_min_max.rs @@ -1,8 +1,8 @@ #[test] fn undefined_width_with_min_max() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { min_size: taffy::geometry::Size { width: taffy::style::Dimension::Length(0f32), height: auto() }, @@ -20,9 +20,9 @@ fn undefined_width_with_min_max() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); diff --git a/tests/generated/flex/undefined_width_with_min_max_row.rs b/tests/generated/flex/undefined_width_with_min_max_row.rs index cef3d9d4b..188bf66ee 100644 --- a/tests/generated/flex/undefined_width_with_min_max_row.rs +++ b/tests/generated/flex/undefined_width_with_min_max_row.rs @@ -1,8 +1,8 @@ #[test] fn undefined_width_with_min_max_row() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -31,9 +31,9 @@ fn undefined_width_with_min_max_row() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); diff --git a/tests/generated/flex/width_smaller_then_content_with_flex_grow_large_size.rs b/tests/generated/flex/width_smaller_then_content_with_flex_grow_large_size.rs index c3004f96b..cfc754fa5 100644 --- a/tests/generated/flex/width_smaller_then_content_with_flex_grow_large_size.rs +++ b/tests/generated/flex/width_smaller_then_content_with_flex_grow_large_size.rs @@ -1,8 +1,8 @@ #[test] fn width_smaller_then_content_with_flex_grow_large_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -52,9 +52,9 @@ fn width_smaller_then_content_with_flex_grow_large_size() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/width_smaller_then_content_with_flex_grow_small_size.rs b/tests/generated/flex/width_smaller_then_content_with_flex_grow_small_size.rs index 3960dcb80..ba1f998b9 100644 --- a/tests/generated/flex/width_smaller_then_content_with_flex_grow_small_size.rs +++ b/tests/generated/flex/width_smaller_then_content_with_flex_grow_small_size.rs @@ -1,8 +1,8 @@ #[test] fn width_smaller_then_content_with_flex_grow_small_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -52,9 +52,9 @@ fn width_smaller_then_content_with_flex_grow_small_size() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node, 10f32, size.width); diff --git a/tests/generated/flex/width_smaller_then_content_with_flex_grow_unconstraint_size.rs b/tests/generated/flex/width_smaller_then_content_with_flex_grow_unconstraint_size.rs index 858f5edb9..2235e438c 100644 --- a/tests/generated/flex/width_smaller_then_content_with_flex_grow_unconstraint_size.rs +++ b/tests/generated/flex/width_smaller_then_content_with_flex_grow_unconstraint_size.rs @@ -1,8 +1,8 @@ #[test] fn width_smaller_then_content_with_flex_grow_unconstraint_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -44,9 +44,9 @@ fn width_smaller_then_content_with_flex_grow_unconstraint_size() { ) .unwrap(); let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0, node1]).unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); diff --git a/tests/generated/flex/width_smaller_then_content_with_flex_grow_very_large_size.rs b/tests/generated/flex/width_smaller_then_content_with_flex_grow_very_large_size.rs index e1c276ded..4e90313c8 100644 --- a/tests/generated/flex/width_smaller_then_content_with_flex_grow_very_large_size.rs +++ b/tests/generated/flex/width_smaller_then_content_with_flex_grow_very_large_size.rs @@ -1,8 +1,8 @@ #[test] fn width_smaller_then_content_with_flex_grow_very_large_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -52,9 +52,9 @@ fn width_smaller_then_content_with_flex_grow_very_large_size() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/flex/wrap_child.rs b/tests/generated/flex/wrap_child.rs index 6e80abd1b..089dea425 100644 --- a/tests/generated/flex/wrap_child.rs +++ b/tests/generated/flex/wrap_child.rs @@ -1,8 +1,8 @@ #[test] fn wrap_child() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -18,9 +18,9 @@ fn wrap_child() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/wrap_column.rs b/tests/generated/flex/wrap_column.rs index 558d30351..501eea370 100644 --- a/tests/generated/flex/wrap_column.rs +++ b/tests/generated/flex/wrap_column.rs @@ -1,8 +1,8 @@ #[test] fn wrap_column() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -53,9 +53,9 @@ fn wrap_column() { &[node0, node1, node2, node3], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/wrap_grandchild.rs b/tests/generated/flex/wrap_grandchild.rs index 34879eee9..d9a7707d9 100644 --- a/tests/generated/flex/wrap_grandchild.rs +++ b/tests/generated/flex/wrap_grandchild.rs @@ -1,8 +1,8 @@ #[test] fn wrap_grandchild() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -14,9 +14,9 @@ fn wrap_grandchild() { .unwrap(); let node0 = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node00]).unwrap(); let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0]).unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/wrap_nodes_with_content_sizing_margin_cross.rs b/tests/generated/flex/wrap_nodes_with_content_sizing_margin_cross.rs index e626b5b3d..8c9a17d9b 100644 --- a/tests/generated/flex/wrap_nodes_with_content_sizing_margin_cross.rs +++ b/tests/generated/flex/wrap_nodes_with_content_sizing_margin_cross.rs @@ -1,8 +1,8 @@ #[test] fn wrap_nodes_with_content_sizing_margin_cross() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node000 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -65,9 +65,9 @@ fn wrap_nodes_with_content_sizing_margin_cross() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 500f32, "width of node {:?}. Expected {}. Actual {}", node, 500f32, size.width); diff --git a/tests/generated/flex/wrap_nodes_with_content_sizing_overflowing_margin.rs b/tests/generated/flex/wrap_nodes_with_content_sizing_overflowing_margin.rs index 41b59df93..57df4b216 100644 --- a/tests/generated/flex/wrap_nodes_with_content_sizing_overflowing_margin.rs +++ b/tests/generated/flex/wrap_nodes_with_content_sizing_overflowing_margin.rs @@ -1,8 +1,8 @@ #[test] fn wrap_nodes_with_content_sizing_overflowing_margin() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node000 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -65,9 +65,9 @@ fn wrap_nodes_with_content_sizing_overflowing_margin() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 500f32, "width of node {:?}. Expected {}. Actual {}", node, 500f32, size.width); diff --git a/tests/generated/flex/wrap_reverse_column.rs b/tests/generated/flex/wrap_reverse_column.rs index 73ef17489..0e105ffab 100644 --- a/tests/generated/flex/wrap_reverse_column.rs +++ b/tests/generated/flex/wrap_reverse_column.rs @@ -1,8 +1,8 @@ #[test] fn wrap_reverse_column() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -53,9 +53,9 @@ fn wrap_reverse_column() { &[node0, node1, node2, node3], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/wrap_reverse_column_fixed_size.rs b/tests/generated/flex/wrap_reverse_column_fixed_size.rs index 08a4ab276..693e7630d 100644 --- a/tests/generated/flex/wrap_reverse_column_fixed_size.rs +++ b/tests/generated/flex/wrap_reverse_column_fixed_size.rs @@ -1,8 +1,8 @@ #[test] fn wrap_reverse_column_fixed_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -63,9 +63,9 @@ fn wrap_reverse_column_fixed_size() { &[node0, node1, node2, node3, node4], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/flex/wrap_reverse_row.rs b/tests/generated/flex/wrap_reverse_row.rs index 6fedc5585..35c63c4e9 100644 --- a/tests/generated/flex/wrap_reverse_row.rs +++ b/tests/generated/flex/wrap_reverse_row.rs @@ -1,8 +1,8 @@ #[test] fn wrap_reverse_row() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -49,9 +49,9 @@ fn wrap_reverse_row() { &[node0, node1, node2, node3], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/wrap_reverse_row_align_content_center.rs b/tests/generated/flex/wrap_reverse_row_align_content_center.rs index f95f598ec..b048e485d 100644 --- a/tests/generated/flex/wrap_reverse_row_align_content_center.rs +++ b/tests/generated/flex/wrap_reverse_row_align_content_center.rs @@ -1,8 +1,8 @@ #[test] fn wrap_reverse_row_align_content_center() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -59,9 +59,9 @@ fn wrap_reverse_row_align_content_center() { &[node0, node1, node2, node3, node4], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/wrap_reverse_row_align_content_flex_start.rs b/tests/generated/flex/wrap_reverse_row_align_content_flex_start.rs index 833ab4db7..71b88fc01 100644 --- a/tests/generated/flex/wrap_reverse_row_align_content_flex_start.rs +++ b/tests/generated/flex/wrap_reverse_row_align_content_flex_start.rs @@ -1,8 +1,8 @@ #[test] fn wrap_reverse_row_align_content_flex_start() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -59,9 +59,9 @@ fn wrap_reverse_row_align_content_flex_start() { &[node0, node1, node2, node3, node4], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/wrap_reverse_row_align_content_space_around.rs b/tests/generated/flex/wrap_reverse_row_align_content_space_around.rs index 94f5d5799..934255de0 100644 --- a/tests/generated/flex/wrap_reverse_row_align_content_space_around.rs +++ b/tests/generated/flex/wrap_reverse_row_align_content_space_around.rs @@ -1,8 +1,8 @@ #[test] fn wrap_reverse_row_align_content_space_around() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -59,9 +59,9 @@ fn wrap_reverse_row_align_content_space_around() { &[node0, node1, node2, node3, node4], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/wrap_reverse_row_align_content_stretch.rs b/tests/generated/flex/wrap_reverse_row_align_content_stretch.rs index e35d9869e..b406e46d6 100644 --- a/tests/generated/flex/wrap_reverse_row_align_content_stretch.rs +++ b/tests/generated/flex/wrap_reverse_row_align_content_stretch.rs @@ -1,8 +1,8 @@ #[test] fn wrap_reverse_row_align_content_stretch() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -59,9 +59,9 @@ fn wrap_reverse_row_align_content_stretch() { &[node0, node1, node2, node3, node4], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/wrap_reverse_row_single_line_different_size.rs b/tests/generated/flex/wrap_reverse_row_single_line_different_size.rs index 0eb98c75c..116e3412d 100644 --- a/tests/generated/flex/wrap_reverse_row_single_line_different_size.rs +++ b/tests/generated/flex/wrap_reverse_row_single_line_different_size.rs @@ -1,8 +1,8 @@ #[test] fn wrap_reverse_row_single_line_different_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -59,9 +59,9 @@ fn wrap_reverse_row_single_line_different_size() { &[node0, node1, node2, node3, node4], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 300f32, "width of node {:?}. Expected {}. Actual {}", node, 300f32, size.width); diff --git a/tests/generated/flex/wrap_row.rs b/tests/generated/flex/wrap_row.rs index a3c40ac1f..2599d3897 100644 --- a/tests/generated/flex/wrap_row.rs +++ b/tests/generated/flex/wrap_row.rs @@ -1,8 +1,8 @@ #[test] fn wrap_row() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -49,9 +49,9 @@ fn wrap_row() { &[node0, node1, node2, node3], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/wrap_row_align_items_center.rs b/tests/generated/flex/wrap_row_align_items_center.rs index 4445ef224..1a7df5b7a 100644 --- a/tests/generated/flex/wrap_row_align_items_center.rs +++ b/tests/generated/flex/wrap_row_align_items_center.rs @@ -1,8 +1,8 @@ #[test] fn wrap_row_align_items_center() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -50,9 +50,9 @@ fn wrap_row_align_items_center() { &[node0, node1, node2, node3], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/wrap_row_align_items_flex_end.rs b/tests/generated/flex/wrap_row_align_items_flex_end.rs index 78f3a97d9..b8cf1f0f5 100644 --- a/tests/generated/flex/wrap_row_align_items_flex_end.rs +++ b/tests/generated/flex/wrap_row_align_items_flex_end.rs @@ -1,8 +1,8 @@ #[test] fn wrap_row_align_items_flex_end() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -50,9 +50,9 @@ fn wrap_row_align_items_flex_end() { &[node0, node1, node2, node3], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/flex/wrapped_column_max_height.rs b/tests/generated/flex/wrapped_column_max_height.rs index 6453a8437..ef35953c5 100644 --- a/tests/generated/flex/wrapped_column_max_height.rs +++ b/tests/generated/flex/wrapped_column_max_height.rs @@ -1,8 +1,8 @@ #[test] fn wrapped_column_max_height() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -54,9 +54,9 @@ fn wrapped_column_max_height() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 700f32, "width of node {:?}. Expected {}. Actual {}", node, 700f32, size.width); diff --git a/tests/generated/flex/wrapped_column_max_height_flex.rs b/tests/generated/flex/wrapped_column_max_height_flex.rs index 64f33d17d..197004783 100644 --- a/tests/generated/flex/wrapped_column_max_height_flex.rs +++ b/tests/generated/flex/wrapped_column_max_height_flex.rs @@ -1,8 +1,8 @@ #[test] fn wrapped_column_max_height_flex() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { flex_grow: 1f32, @@ -60,9 +60,9 @@ fn wrapped_column_max_height_flex() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 700f32, "width of node {:?}. Expected {}. Actual {}", node, 700f32, size.width); diff --git a/tests/generated/flex/wrapped_row_within_align_items_center.rs b/tests/generated/flex/wrapped_row_within_align_items_center.rs index f9254802b..ebe3a03ea 100644 --- a/tests/generated/flex/wrapped_row_within_align_items_center.rs +++ b/tests/generated/flex/wrapped_row_within_align_items_center.rs @@ -1,8 +1,8 @@ #[test] fn wrapped_row_within_align_items_center() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -41,9 +41,9 @@ fn wrapped_row_within_align_items_center() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/flex/wrapped_row_within_align_items_flex_end.rs b/tests/generated/flex/wrapped_row_within_align_items_flex_end.rs index 165166a40..89ad15385 100644 --- a/tests/generated/flex/wrapped_row_within_align_items_flex_end.rs +++ b/tests/generated/flex/wrapped_row_within_align_items_flex_end.rs @@ -1,8 +1,8 @@ #[test] fn wrapped_row_within_align_items_flex_end() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -41,9 +41,9 @@ fn wrapped_row_within_align_items_flex_end() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/flex/wrapped_row_within_align_items_flex_start.rs b/tests/generated/flex/wrapped_row_within_align_items_flex_start.rs index ad30aedee..2bf2f583a 100644 --- a/tests/generated/flex/wrapped_row_within_align_items_flex_start.rs +++ b/tests/generated/flex/wrapped_row_within_align_items_flex_start.rs @@ -1,8 +1,8 @@ #[test] fn wrapped_row_within_align_items_flex_start() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -41,9 +41,9 @@ fn wrapped_row_within_align_items_flex_start() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/grid/grid_absolute_align_self_sized_all.rs b/tests/generated/grid/grid_absolute_align_self_sized_all.rs index 39376cb8d..71906b873 100644 --- a/tests/generated/grid/grid_absolute_align_self_sized_all.rs +++ b/tests/generated/grid/grid_absolute_align_self_sized_all.rs @@ -1,8 +1,8 @@ #[test] fn grid_absolute_align_self_sized_all() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -106,9 +106,9 @@ fn grid_absolute_align_self_sized_all() { &[node0, node1, node2, node3, node4, node5, node6, node7], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); diff --git a/tests/generated/grid/grid_absolute_column_end.rs b/tests/generated/grid/grid_absolute_column_end.rs index a831377d4..0af6dee8e 100644 --- a/tests/generated/grid/grid_absolute_column_end.rs +++ b/tests/generated/grid/grid_absolute_column_end.rs @@ -1,8 +1,8 @@ #[test] fn grid_absolute_column_end() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -33,9 +33,9 @@ fn grid_absolute_column_end() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); diff --git a/tests/generated/grid/grid_absolute_column_start.rs b/tests/generated/grid/grid_absolute_column_start.rs index 39d3596a7..9c85f5426 100644 --- a/tests/generated/grid/grid_absolute_column_start.rs +++ b/tests/generated/grid/grid_absolute_column_start.rs @@ -1,8 +1,8 @@ #[test] fn grid_absolute_column_start() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -33,9 +33,9 @@ fn grid_absolute_column_start() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); diff --git a/tests/generated/grid/grid_absolute_container_bottom_left.rs b/tests/generated/grid/grid_absolute_container_bottom_left.rs index 7854df8db..b5020f323 100644 --- a/tests/generated/grid/grid_absolute_container_bottom_left.rs +++ b/tests/generated/grid/grid_absolute_container_bottom_left.rs @@ -1,8 +1,8 @@ #[test] fn grid_absolute_container_bottom_left() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -40,9 +40,9 @@ fn grid_absolute_container_bottom_left() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); diff --git a/tests/generated/grid/grid_absolute_container_bottom_left_margin.rs b/tests/generated/grid/grid_absolute_container_bottom_left_margin.rs index 5655d25d7..d841caa94 100644 --- a/tests/generated/grid/grid_absolute_container_bottom_left_margin.rs +++ b/tests/generated/grid/grid_absolute_container_bottom_left_margin.rs @@ -1,8 +1,8 @@ #[test] fn grid_absolute_container_bottom_left_margin() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -50,9 +50,9 @@ fn grid_absolute_container_bottom_left_margin() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); diff --git a/tests/generated/grid/grid_absolute_container_left_overrides_right.rs b/tests/generated/grid/grid_absolute_container_left_overrides_right.rs index e09a5c830..331aa7797 100644 --- a/tests/generated/grid/grid_absolute_container_left_overrides_right.rs +++ b/tests/generated/grid/grid_absolute_container_left_overrides_right.rs @@ -1,8 +1,8 @@ #[test] fn grid_absolute_container_left_overrides_right() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -41,9 +41,9 @@ fn grid_absolute_container_left_overrides_right() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); diff --git a/tests/generated/grid/grid_absolute_container_left_right.rs b/tests/generated/grid/grid_absolute_container_left_right.rs index cc666134b..17b0dd1f5 100644 --- a/tests/generated/grid/grid_absolute_container_left_right.rs +++ b/tests/generated/grid/grid_absolute_container_left_right.rs @@ -1,8 +1,8 @@ #[test] fn grid_absolute_container_left_right() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -40,9 +40,9 @@ fn grid_absolute_container_left_right() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); diff --git a/tests/generated/grid/grid_absolute_container_left_right_margin.rs b/tests/generated/grid/grid_absolute_container_left_right_margin.rs index 77fa653d6..6c61cd13a 100644 --- a/tests/generated/grid/grid_absolute_container_left_right_margin.rs +++ b/tests/generated/grid/grid_absolute_container_left_right_margin.rs @@ -1,8 +1,8 @@ #[test] fn grid_absolute_container_left_right_margin() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -46,9 +46,9 @@ fn grid_absolute_container_left_right_margin() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); diff --git a/tests/generated/grid/grid_absolute_container_negative_position.rs b/tests/generated/grid/grid_absolute_container_negative_position.rs index 1fbb57b5c..414721f4f 100644 --- a/tests/generated/grid/grid_absolute_container_negative_position.rs +++ b/tests/generated/grid/grid_absolute_container_negative_position.rs @@ -1,8 +1,8 @@ #[test] fn grid_absolute_container_negative_position() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -51,9 +51,9 @@ fn grid_absolute_container_negative_position() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); diff --git a/tests/generated/grid/grid_absolute_container_negative_position_margin.rs b/tests/generated/grid/grid_absolute_container_negative_position_margin.rs index 9fca0efdb..2e02422c6 100644 --- a/tests/generated/grid/grid_absolute_container_negative_position_margin.rs +++ b/tests/generated/grid/grid_absolute_container_negative_position_margin.rs @@ -1,8 +1,8 @@ #[test] fn grid_absolute_container_negative_position_margin() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -63,9 +63,9 @@ fn grid_absolute_container_negative_position_margin() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); diff --git a/tests/generated/grid/grid_absolute_container_top_bottom.rs b/tests/generated/grid/grid_absolute_container_top_bottom.rs index 3e21ca8ef..49274d457 100644 --- a/tests/generated/grid/grid_absolute_container_top_bottom.rs +++ b/tests/generated/grid/grid_absolute_container_top_bottom.rs @@ -1,8 +1,8 @@ #[test] fn grid_absolute_container_top_bottom() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -40,9 +40,9 @@ fn grid_absolute_container_top_bottom() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); diff --git a/tests/generated/grid/grid_absolute_container_top_bottom_margin.rs b/tests/generated/grid/grid_absolute_container_top_bottom_margin.rs index 687f62b22..f8cf88308 100644 --- a/tests/generated/grid/grid_absolute_container_top_bottom_margin.rs +++ b/tests/generated/grid/grid_absolute_container_top_bottom_margin.rs @@ -1,8 +1,8 @@ #[test] fn grid_absolute_container_top_bottom_margin() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -46,9 +46,9 @@ fn grid_absolute_container_top_bottom_margin() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); diff --git a/tests/generated/grid/grid_absolute_container_top_right.rs b/tests/generated/grid/grid_absolute_container_top_right.rs index 718a8eea6..0c6cca058 100644 --- a/tests/generated/grid/grid_absolute_container_top_right.rs +++ b/tests/generated/grid/grid_absolute_container_top_right.rs @@ -1,8 +1,8 @@ #[test] fn grid_absolute_container_top_right() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -40,9 +40,9 @@ fn grid_absolute_container_top_right() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); diff --git a/tests/generated/grid/grid_absolute_container_top_right_margin.rs b/tests/generated/grid/grid_absolute_container_top_right_margin.rs index e7fe56880..29f5ccc1a 100644 --- a/tests/generated/grid/grid_absolute_container_top_right_margin.rs +++ b/tests/generated/grid/grid_absolute_container_top_right_margin.rs @@ -1,8 +1,8 @@ #[test] fn grid_absolute_container_top_right_margin() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -46,9 +46,9 @@ fn grid_absolute_container_top_right_margin() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); diff --git a/tests/generated/grid/grid_absolute_justify_self_sized_all.rs b/tests/generated/grid/grid_absolute_justify_self_sized_all.rs index 748d52c2d..d9a1fb9b2 100644 --- a/tests/generated/grid/grid_absolute_justify_self_sized_all.rs +++ b/tests/generated/grid/grid_absolute_justify_self_sized_all.rs @@ -1,8 +1,8 @@ #[test] fn grid_absolute_justify_self_sized_all() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -106,9 +106,9 @@ fn grid_absolute_justify_self_sized_all() { &[node0, node1, node2, node3, node4, node5, node6, node7], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); diff --git a/tests/generated/grid/grid_absolute_layout_within_border.rs b/tests/generated/grid/grid_absolute_layout_within_border.rs index 088345321..765cbba7b 100644 --- a/tests/generated/grid/grid_absolute_layout_within_border.rs +++ b/tests/generated/grid/grid_absolute_layout_within_border.rs @@ -1,8 +1,8 @@ #[test] fn grid_absolute_layout_within_border() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -104,9 +104,9 @@ fn grid_absolute_layout_within_border() { &[node0, node1, node2, node3], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/grid/grid_absolute_layout_within_border_static.rs b/tests/generated/grid/grid_absolute_layout_within_border_static.rs index f2c9b9c36..175eacc31 100644 --- a/tests/generated/grid/grid_absolute_layout_within_border_static.rs +++ b/tests/generated/grid/grid_absolute_layout_within_border_static.rs @@ -1,8 +1,8 @@ #[test] fn grid_absolute_layout_within_border_static() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -88,9 +88,9 @@ fn grid_absolute_layout_within_border_static() { &[node0, node1, node2, node3], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/grid/grid_absolute_row_end.rs b/tests/generated/grid/grid_absolute_row_end.rs index fea7ed114..c01c7e3e1 100644 --- a/tests/generated/grid/grid_absolute_row_end.rs +++ b/tests/generated/grid/grid_absolute_row_end.rs @@ -1,8 +1,8 @@ #[test] fn grid_absolute_row_end() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -33,9 +33,9 @@ fn grid_absolute_row_end() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); diff --git a/tests/generated/grid/grid_absolute_row_start.rs b/tests/generated/grid/grid_absolute_row_start.rs index de6af9370..4adf89590 100644 --- a/tests/generated/grid/grid_absolute_row_start.rs +++ b/tests/generated/grid/grid_absolute_row_start.rs @@ -1,8 +1,8 @@ #[test] fn grid_absolute_row_start() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -33,9 +33,9 @@ fn grid_absolute_row_start() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); diff --git a/tests/generated/grid/grid_absolute_top_overrides_bottom.rs b/tests/generated/grid/grid_absolute_top_overrides_bottom.rs index 11c146828..6af5c048c 100644 --- a/tests/generated/grid/grid_absolute_top_overrides_bottom.rs +++ b/tests/generated/grid/grid_absolute_top_overrides_bottom.rs @@ -1,8 +1,8 @@ #[test] fn grid_absolute_top_overrides_bottom() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -41,9 +41,9 @@ fn grid_absolute_top_overrides_bottom() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); diff --git a/tests/generated/grid/grid_absolute_with_padding.rs b/tests/generated/grid/grid_absolute_with_padding.rs index 964340aa9..7bb294e51 100644 --- a/tests/generated/grid/grid_absolute_with_padding.rs +++ b/tests/generated/grid/grid_absolute_with_padding.rs @@ -1,8 +1,8 @@ #[test] fn grid_absolute_with_padding() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -51,9 +51,9 @@ fn grid_absolute_with_padding() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); diff --git a/tests/generated/grid/grid_absolute_with_padding_and_margin.rs b/tests/generated/grid/grid_absolute_with_padding_and_margin.rs index 58b00e327..ce519ccc8 100644 --- a/tests/generated/grid/grid_absolute_with_padding_and_margin.rs +++ b/tests/generated/grid/grid_absolute_with_padding_and_margin.rs @@ -1,8 +1,8 @@ #[test] fn grid_absolute_with_padding_and_margin() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -63,9 +63,9 @@ fn grid_absolute_with_padding_and_margin() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); diff --git a/tests/generated/grid/grid_align_content_center.rs b/tests/generated/grid/grid_align_content_center.rs index 9f9fa57bb..8aaac0df8 100644 --- a/tests/generated/grid/grid_align_content_center.rs +++ b/tests/generated/grid/grid_align_content_center.rs @@ -1,8 +1,8 @@ #[test] fn grid_align_content_center() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -28,9 +28,9 @@ fn grid_align_content_center() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/grid/grid_align_content_center_negative_space_gap.rs b/tests/generated/grid/grid_align_content_center_negative_space_gap.rs index 216dedaf6..1b382ccee 100644 --- a/tests/generated/grid/grid_align_content_center_negative_space_gap.rs +++ b/tests/generated/grid/grid_align_content_center_negative_space_gap.rs @@ -1,8 +1,8 @@ #[test] fn grid_align_content_center_negative_space_gap() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node01 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node02 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -52,9 +52,9 @@ fn grid_align_content_center_negative_space_gap() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 240f32, "width of node {:?}. Expected {}. Actual {}", node, 240f32, size.width); diff --git a/tests/generated/grid/grid_align_content_end.rs b/tests/generated/grid/grid_align_content_end.rs index d1a1d0392..bd3ceee09 100644 --- a/tests/generated/grid/grid_align_content_end.rs +++ b/tests/generated/grid/grid_align_content_end.rs @@ -1,8 +1,8 @@ #[test] fn grid_align_content_end() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -28,9 +28,9 @@ fn grid_align_content_end() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/grid/grid_align_content_end_negative_space_gap.rs b/tests/generated/grid/grid_align_content_end_negative_space_gap.rs index 5ae9e7c41..ea9380973 100644 --- a/tests/generated/grid/grid_align_content_end_negative_space_gap.rs +++ b/tests/generated/grid/grid_align_content_end_negative_space_gap.rs @@ -1,8 +1,8 @@ #[test] fn grid_align_content_end_negative_space_gap() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node01 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node02 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -52,9 +52,9 @@ fn grid_align_content_end_negative_space_gap() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 240f32, "width of node {:?}. Expected {}. Actual {}", node, 240f32, size.width); diff --git a/tests/generated/grid/grid_align_content_end_with_padding_border.rs b/tests/generated/grid/grid_align_content_end_with_padding_border.rs index 4b8376fc7..e83027df6 100644 --- a/tests/generated/grid/grid_align_content_end_with_padding_border.rs +++ b/tests/generated/grid/grid_align_content_end_with_padding_border.rs @@ -1,8 +1,8 @@ #[test] fn grid_align_content_end_with_padding_border() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -40,9 +40,9 @@ fn grid_align_content_end_with_padding_border() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/grid/grid_align_content_space_around.rs b/tests/generated/grid/grid_align_content_space_around.rs index d8b7de10e..35b120ada 100644 --- a/tests/generated/grid/grid_align_content_space_around.rs +++ b/tests/generated/grid/grid_align_content_space_around.rs @@ -1,8 +1,8 @@ #[test] fn grid_align_content_space_around() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -28,9 +28,9 @@ fn grid_align_content_space_around() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/grid/grid_align_content_space_around_negative_space_gap.rs b/tests/generated/grid/grid_align_content_space_around_negative_space_gap.rs index 722feb601..3381ad96a 100644 --- a/tests/generated/grid/grid_align_content_space_around_negative_space_gap.rs +++ b/tests/generated/grid/grid_align_content_space_around_negative_space_gap.rs @@ -1,8 +1,8 @@ #[test] fn grid_align_content_space_around_negative_space_gap() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node01 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node02 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -52,9 +52,9 @@ fn grid_align_content_space_around_negative_space_gap() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 240f32, "width of node {:?}. Expected {}. Actual {}", node, 240f32, size.width); diff --git a/tests/generated/grid/grid_align_content_space_around_with_padding_border.rs b/tests/generated/grid/grid_align_content_space_around_with_padding_border.rs index f30c1bcbe..b00fb36f7 100644 --- a/tests/generated/grid/grid_align_content_space_around_with_padding_border.rs +++ b/tests/generated/grid/grid_align_content_space_around_with_padding_border.rs @@ -1,8 +1,8 @@ #[test] fn grid_align_content_space_around_with_padding_border() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -40,9 +40,9 @@ fn grid_align_content_space_around_with_padding_border() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/grid/grid_align_content_space_between.rs b/tests/generated/grid/grid_align_content_space_between.rs index 8f38b2e38..e22e80037 100644 --- a/tests/generated/grid/grid_align_content_space_between.rs +++ b/tests/generated/grid/grid_align_content_space_between.rs @@ -1,8 +1,8 @@ #[test] fn grid_align_content_space_between() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -28,9 +28,9 @@ fn grid_align_content_space_between() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/grid/grid_align_content_space_between_negative_space_gap.rs b/tests/generated/grid/grid_align_content_space_between_negative_space_gap.rs index 7176a5e8e..2e231ea61 100644 --- a/tests/generated/grid/grid_align_content_space_between_negative_space_gap.rs +++ b/tests/generated/grid/grid_align_content_space_between_negative_space_gap.rs @@ -1,8 +1,8 @@ #[test] fn grid_align_content_space_between_negative_space_gap() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node01 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node02 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -52,9 +52,9 @@ fn grid_align_content_space_between_negative_space_gap() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 240f32, "width of node {:?}. Expected {}. Actual {}", node, 240f32, size.width); diff --git a/tests/generated/grid/grid_align_content_space_between_with_padding_border.rs b/tests/generated/grid/grid_align_content_space_between_with_padding_border.rs index d3fcd9e48..3a59ed712 100644 --- a/tests/generated/grid/grid_align_content_space_between_with_padding_border.rs +++ b/tests/generated/grid/grid_align_content_space_between_with_padding_border.rs @@ -1,8 +1,8 @@ #[test] fn grid_align_content_space_between_with_padding_border() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -40,9 +40,9 @@ fn grid_align_content_space_between_with_padding_border() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/grid/grid_align_content_space_evenly.rs b/tests/generated/grid/grid_align_content_space_evenly.rs index 5fef3974c..35cd4f7ca 100644 --- a/tests/generated/grid/grid_align_content_space_evenly.rs +++ b/tests/generated/grid/grid_align_content_space_evenly.rs @@ -1,8 +1,8 @@ #[test] fn grid_align_content_space_evenly() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -28,9 +28,9 @@ fn grid_align_content_space_evenly() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/grid/grid_align_content_space_evenly_negative_space_gap.rs b/tests/generated/grid/grid_align_content_space_evenly_negative_space_gap.rs index 191b01e4d..b35d8aad2 100644 --- a/tests/generated/grid/grid_align_content_space_evenly_negative_space_gap.rs +++ b/tests/generated/grid/grid_align_content_space_evenly_negative_space_gap.rs @@ -1,8 +1,8 @@ #[test] fn grid_align_content_space_evenly_negative_space_gap() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node01 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node02 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -52,9 +52,9 @@ fn grid_align_content_space_evenly_negative_space_gap() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 240f32, "width of node {:?}. Expected {}. Actual {}", node, 240f32, size.width); diff --git a/tests/generated/grid/grid_align_content_space_evenly_with_padding_border.rs b/tests/generated/grid/grid_align_content_space_evenly_with_padding_border.rs index a83c07a08..3b75e84f4 100644 --- a/tests/generated/grid/grid_align_content_space_evenly_with_padding_border.rs +++ b/tests/generated/grid/grid_align_content_space_evenly_with_padding_border.rs @@ -1,8 +1,8 @@ #[test] fn grid_align_content_space_evenly_with_padding_border() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -40,9 +40,9 @@ fn grid_align_content_space_evenly_with_padding_border() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/grid/grid_align_content_start.rs b/tests/generated/grid/grid_align_content_start.rs index d27b9ea07..ed2d29f57 100644 --- a/tests/generated/grid/grid_align_content_start.rs +++ b/tests/generated/grid/grid_align_content_start.rs @@ -1,8 +1,8 @@ #[test] fn grid_align_content_start() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -28,9 +28,9 @@ fn grid_align_content_start() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/grid/grid_align_content_start_negative_space_gap.rs b/tests/generated/grid/grid_align_content_start_negative_space_gap.rs index a7755180a..eb15db686 100644 --- a/tests/generated/grid/grid_align_content_start_negative_space_gap.rs +++ b/tests/generated/grid/grid_align_content_start_negative_space_gap.rs @@ -1,8 +1,8 @@ #[test] fn grid_align_content_start_negative_space_gap() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node01 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node02 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -52,9 +52,9 @@ fn grid_align_content_start_negative_space_gap() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 240f32, "width of node {:?}. Expected {}. Actual {}", node, 240f32, size.width); diff --git a/tests/generated/grid/grid_align_content_start_with_padding_border.rs b/tests/generated/grid/grid_align_content_start_with_padding_border.rs index 0c66cdbf1..5d53211a6 100644 --- a/tests/generated/grid/grid_align_content_start_with_padding_border.rs +++ b/tests/generated/grid/grid_align_content_start_with_padding_border.rs @@ -1,8 +1,8 @@ #[test] fn grid_align_content_start_with_padding_border() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -40,9 +40,9 @@ fn grid_align_content_start_with_padding_border() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/grid/grid_align_items_baseline.rs b/tests/generated/grid/grid_align_items_baseline.rs index 0fa9610ac..7f3a3767d 100644 --- a/tests/generated/grid/grid_align_items_baseline.rs +++ b/tests/generated/grid/grid_align_items_baseline.rs @@ -1,8 +1,8 @@ #[test] fn grid_align_items_baseline() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, @@ -37,9 +37,9 @@ fn grid_align_items_baseline() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/grid/grid_align_items_baseline_child.rs b/tests/generated/grid/grid_align_items_baseline_child.rs index 2128f1f5c..f40682332 100644 --- a/tests/generated/grid/grid_align_items_baseline_child.rs +++ b/tests/generated/grid/grid_align_items_baseline_child.rs @@ -1,8 +1,8 @@ #[test] fn grid_align_items_baseline_child() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, @@ -50,9 +50,9 @@ fn grid_align_items_baseline_child() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/grid/grid_align_items_baseline_child_margin.rs b/tests/generated/grid/grid_align_items_baseline_child_margin.rs index 5cd74de40..32bb83dee 100644 --- a/tests/generated/grid/grid_align_items_baseline_child_margin.rs +++ b/tests/generated/grid/grid_align_items_baseline_child_margin.rs @@ -1,8 +1,8 @@ #[test] fn grid_align_items_baseline_child_margin() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, @@ -62,9 +62,9 @@ fn grid_align_items_baseline_child_margin() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/grid/grid_align_items_baseline_child_margin_percent.rs b/tests/generated/grid/grid_align_items_baseline_child_margin_percent.rs index 38b8bee3c..4be170ff0 100644 --- a/tests/generated/grid/grid_align_items_baseline_child_margin_percent.rs +++ b/tests/generated/grid/grid_align_items_baseline_child_margin_percent.rs @@ -1,8 +1,8 @@ #[test] fn grid_align_items_baseline_child_margin_percent() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, @@ -62,9 +62,9 @@ fn grid_align_items_baseline_child_margin_percent() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/grid/grid_align_items_baseline_child_multiline.rs b/tests/generated/grid/grid_align_items_baseline_child_multiline.rs index e6cbcb125..97d93fe31 100644 --- a/tests/generated/grid/grid_align_items_baseline_child_multiline.rs +++ b/tests/generated/grid/grid_align_items_baseline_child_multiline.rs @@ -1,8 +1,8 @@ #[test] fn grid_align_items_baseline_child_multiline() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, @@ -76,9 +76,9 @@ fn grid_align_items_baseline_child_multiline() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/grid/grid_align_items_baseline_child_multiline_no_override_on_secondline.rs b/tests/generated/grid/grid_align_items_baseline_child_multiline_no_override_on_secondline.rs index 8fdd5d481..a7dc2829c 100644 --- a/tests/generated/grid/grid_align_items_baseline_child_multiline_no_override_on_secondline.rs +++ b/tests/generated/grid/grid_align_items_baseline_child_multiline_no_override_on_secondline.rs @@ -1,8 +1,8 @@ #[test] fn grid_align_items_baseline_child_multiline_no_override_on_secondline() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, @@ -82,9 +82,9 @@ fn grid_align_items_baseline_child_multiline_no_override_on_secondline() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/grid/grid_align_items_baseline_child_multiline_override.rs b/tests/generated/grid/grid_align_items_baseline_child_multiline_override.rs index 12b5cec31..0efc9aae6 100644 --- a/tests/generated/grid/grid_align_items_baseline_child_multiline_override.rs +++ b/tests/generated/grid/grid_align_items_baseline_child_multiline_override.rs @@ -1,8 +1,8 @@ #[test] fn grid_align_items_baseline_child_multiline_override() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, @@ -83,9 +83,9 @@ fn grid_align_items_baseline_child_multiline_override() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/grid/grid_align_items_baseline_child_padding.rs b/tests/generated/grid/grid_align_items_baseline_child_padding.rs index 57ca591cd..9f096569a 100644 --- a/tests/generated/grid/grid_align_items_baseline_child_padding.rs +++ b/tests/generated/grid/grid_align_items_baseline_child_padding.rs @@ -1,8 +1,8 @@ #[test] fn grid_align_items_baseline_child_padding() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, @@ -62,9 +62,9 @@ fn grid_align_items_baseline_child_padding() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/grid/grid_align_items_baseline_child_top.rs b/tests/generated/grid/grid_align_items_baseline_child_top.rs index b96388d64..b4a6a02b6 100644 --- a/tests/generated/grid/grid_align_items_baseline_child_top.rs +++ b/tests/generated/grid/grid_align_items_baseline_child_top.rs @@ -1,8 +1,8 @@ #[test] fn grid_align_items_baseline_child_top() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, @@ -56,9 +56,9 @@ fn grid_align_items_baseline_child_top() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/grid/grid_align_items_baseline_child_top2.rs b/tests/generated/grid/grid_align_items_baseline_child_top2.rs index 97e3e7eab..c49c95d87 100644 --- a/tests/generated/grid/grid_align_items_baseline_child_top2.rs +++ b/tests/generated/grid/grid_align_items_baseline_child_top2.rs @@ -1,8 +1,8 @@ #[test] fn grid_align_items_baseline_child_top2() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, @@ -56,9 +56,9 @@ fn grid_align_items_baseline_child_top2() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/grid/grid_align_items_baseline_complex.rs b/tests/generated/grid/grid_align_items_baseline_complex.rs index 6e0f1ba19..ec9aad7f1 100644 --- a/tests/generated/grid/grid_align_items_baseline_complex.rs +++ b/tests/generated/grid/grid_align_items_baseline_complex.rs @@ -1,8 +1,8 @@ #[test] fn grid_align_items_baseline_complex() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -136,9 +136,9 @@ fn grid_align_items_baseline_complex() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); diff --git a/tests/generated/grid/grid_align_items_baseline_double_nested_child.rs b/tests/generated/grid/grid_align_items_baseline_double_nested_child.rs index b717fa5b0..946de194b 100644 --- a/tests/generated/grid/grid_align_items_baseline_double_nested_child.rs +++ b/tests/generated/grid/grid_align_items_baseline_double_nested_child.rs @@ -1,8 +1,8 @@ #[test] fn grid_align_items_baseline_double_nested_child() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, @@ -63,9 +63,9 @@ fn grid_align_items_baseline_double_nested_child() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/grid/grid_align_items_baseline_multiline.rs b/tests/generated/grid/grid_align_items_baseline_multiline.rs index 4654bef6f..14907a7fa 100644 --- a/tests/generated/grid/grid_align_items_baseline_multiline.rs +++ b/tests/generated/grid/grid_align_items_baseline_multiline.rs @@ -1,8 +1,8 @@ #[test] fn grid_align_items_baseline_multiline() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, @@ -84,9 +84,9 @@ fn grid_align_items_baseline_multiline() { &[node0, node1, node2, node3], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/grid/grid_align_items_baseline_multiline_column.rs b/tests/generated/grid/grid_align_items_baseline_multiline_column.rs index 37cf4b9fd..88a1cd881 100644 --- a/tests/generated/grid/grid_align_items_baseline_multiline_column.rs +++ b/tests/generated/grid/grid_align_items_baseline_multiline_column.rs @@ -1,8 +1,8 @@ #[test] fn grid_align_items_baseline_multiline_column() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, @@ -84,9 +84,9 @@ fn grid_align_items_baseline_multiline_column() { &[node0, node1, node2, node3], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/grid/grid_align_items_baseline_multiline_row_and_column.rs b/tests/generated/grid/grid_align_items_baseline_multiline_row_and_column.rs index d3e0345dc..32acabdb4 100644 --- a/tests/generated/grid/grid_align_items_baseline_multiline_row_and_column.rs +++ b/tests/generated/grid/grid_align_items_baseline_multiline_row_and_column.rs @@ -1,8 +1,8 @@ #[test] fn grid_align_items_baseline_multiline_row_and_column() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, @@ -84,9 +84,9 @@ fn grid_align_items_baseline_multiline_row_and_column() { &[node0, node1, node2, node3], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/grid/grid_align_items_baseline_nested_column.rs b/tests/generated/grid/grid_align_items_baseline_nested_column.rs index 67a7faa78..6fddf8111 100644 --- a/tests/generated/grid/grid_align_items_baseline_nested_column.rs +++ b/tests/generated/grid/grid_align_items_baseline_nested_column.rs @@ -1,8 +1,8 @@ #[test] fn grid_align_items_baseline_nested_column() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, @@ -66,9 +66,9 @@ fn grid_align_items_baseline_nested_column() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/grid/grid_align_items_sized_center.rs b/tests/generated/grid/grid_align_items_sized_center.rs index 4ebd3ca20..6d350e42f 100644 --- a/tests/generated/grid/grid_align_items_sized_center.rs +++ b/tests/generated/grid/grid_align_items_sized_center.rs @@ -1,8 +1,8 @@ #[test] fn grid_align_items_sized_center() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, @@ -41,9 +41,9 @@ fn grid_align_items_sized_center() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); diff --git a/tests/generated/grid/grid_align_items_sized_end.rs b/tests/generated/grid/grid_align_items_sized_end.rs index e0aa4614e..e1582923d 100644 --- a/tests/generated/grid/grid_align_items_sized_end.rs +++ b/tests/generated/grid/grid_align_items_sized_end.rs @@ -1,8 +1,8 @@ #[test] fn grid_align_items_sized_end() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, @@ -41,9 +41,9 @@ fn grid_align_items_sized_end() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); diff --git a/tests/generated/grid/grid_align_items_sized_start.rs b/tests/generated/grid/grid_align_items_sized_start.rs index 640503ce7..33b7941e6 100644 --- a/tests/generated/grid/grid_align_items_sized_start.rs +++ b/tests/generated/grid/grid_align_items_sized_start.rs @@ -1,8 +1,8 @@ #[test] fn grid_align_items_sized_start() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, @@ -41,9 +41,9 @@ fn grid_align_items_sized_start() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); diff --git a/tests/generated/grid/grid_align_items_sized_stretch.rs b/tests/generated/grid/grid_align_items_sized_stretch.rs index 3768e050f..a5c840547 100644 --- a/tests/generated/grid/grid_align_items_sized_stretch.rs +++ b/tests/generated/grid/grid_align_items_sized_stretch.rs @@ -1,8 +1,8 @@ #[test] fn grid_align_items_sized_stretch() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, @@ -41,9 +41,9 @@ fn grid_align_items_sized_stretch() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); diff --git a/tests/generated/grid/grid_align_self_sized_all.rs b/tests/generated/grid/grid_align_self_sized_all.rs index ed8bce4f4..14b16798d 100644 --- a/tests/generated/grid/grid_align_self_sized_all.rs +++ b/tests/generated/grid/grid_align_self_sized_all.rs @@ -1,8 +1,8 @@ #[test] fn grid_align_self_sized_all() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { align_self: Some(taffy::style::AlignSelf::Start), @@ -98,9 +98,9 @@ fn grid_align_self_sized_all() { &[node0, node1, node2, node3, node4, node5, node6, node7], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); diff --git a/tests/generated/grid/grid_aspect_ratio_absolute_aspect_ratio_overrides_height_of_full_inset.rs b/tests/generated/grid/grid_aspect_ratio_absolute_aspect_ratio_overrides_height_of_full_inset.rs index 8299badc0..2b5983d50 100644 --- a/tests/generated/grid/grid_aspect_ratio_absolute_aspect_ratio_overrides_height_of_full_inset.rs +++ b/tests/generated/grid/grid_aspect_ratio_absolute_aspect_ratio_overrides_height_of_full_inset.rs @@ -1,8 +1,8 @@ #[test] fn grid_aspect_ratio_absolute_aspect_ratio_overrides_height_of_full_inset() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -29,9 +29,9 @@ fn grid_aspect_ratio_absolute_aspect_ratio_overrides_height_of_full_inset() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); diff --git a/tests/generated/grid/grid_aspect_ratio_absolute_fill_height_from_inset.rs b/tests/generated/grid/grid_aspect_ratio_absolute_fill_height_from_inset.rs index ee3f8d060..9b6b8b15b 100644 --- a/tests/generated/grid/grid_aspect_ratio_absolute_fill_height_from_inset.rs +++ b/tests/generated/grid/grid_aspect_ratio_absolute_fill_height_from_inset.rs @@ -1,8 +1,8 @@ #[test] fn grid_aspect_ratio_absolute_fill_height_from_inset() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -29,9 +29,9 @@ fn grid_aspect_ratio_absolute_fill_height_from_inset() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); diff --git a/tests/generated/grid/grid_aspect_ratio_absolute_fill_width_from_inset.rs b/tests/generated/grid/grid_aspect_ratio_absolute_fill_width_from_inset.rs index 88bc1423d..6f40c282b 100644 --- a/tests/generated/grid/grid_aspect_ratio_absolute_fill_width_from_inset.rs +++ b/tests/generated/grid/grid_aspect_ratio_absolute_fill_width_from_inset.rs @@ -1,8 +1,8 @@ #[test] fn grid_aspect_ratio_absolute_fill_width_from_inset() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -29,9 +29,9 @@ fn grid_aspect_ratio_absolute_fill_width_from_inset() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); diff --git a/tests/generated/grid/grid_aspect_ratio_absolute_height_overrides_inset.rs b/tests/generated/grid/grid_aspect_ratio_absolute_height_overrides_inset.rs index 377f29fb3..05fc09b87 100644 --- a/tests/generated/grid/grid_aspect_ratio_absolute_height_overrides_inset.rs +++ b/tests/generated/grid/grid_aspect_ratio_absolute_height_overrides_inset.rs @@ -1,8 +1,8 @@ #[test] fn grid_aspect_ratio_absolute_height_overrides_inset() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -30,9 +30,9 @@ fn grid_aspect_ratio_absolute_height_overrides_inset() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); diff --git a/tests/generated/grid/grid_aspect_ratio_absolute_width_overrides_inset.rs b/tests/generated/grid/grid_aspect_ratio_absolute_width_overrides_inset.rs index 244566afb..b668526db 100644 --- a/tests/generated/grid/grid_aspect_ratio_absolute_width_overrides_inset.rs +++ b/tests/generated/grid/grid_aspect_ratio_absolute_width_overrides_inset.rs @@ -1,8 +1,8 @@ #[test] fn grid_aspect_ratio_absolute_width_overrides_inset() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, @@ -30,9 +30,9 @@ fn grid_aspect_ratio_absolute_width_overrides_inset() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); diff --git a/tests/generated/grid/grid_aspect_ratio_child_fill_content_height.rs b/tests/generated/grid/grid_aspect_ratio_child_fill_content_height.rs index 864be64ce..1451915b1 100644 --- a/tests/generated/grid/grid_aspect_ratio_child_fill_content_height.rs +++ b/tests/generated/grid/grid_aspect_ratio_child_fill_content_height.rs @@ -1,21 +1,16 @@ #[test] fn grid_aspect_ratio_child_fill_content_height() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { aspect_ratio: Some(0.5f32), ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HHHH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - Some(0.5f32), - ) - }), + crate::TextMeasure { + text_content: "HHHH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: Some(0.5f32), + }, ) .unwrap(); let node1 = taffy @@ -30,9 +25,9 @@ fn grid_aspect_ratio_child_fill_content_height() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); diff --git a/tests/generated/grid/grid_aspect_ratio_child_fill_content_width.rs b/tests/generated/grid/grid_aspect_ratio_child_fill_content_width.rs index c8c55d1bc..65e60e9b7 100644 --- a/tests/generated/grid/grid_aspect_ratio_child_fill_content_width.rs +++ b/tests/generated/grid/grid_aspect_ratio_child_fill_content_width.rs @@ -1,21 +1,16 @@ #[test] fn grid_aspect_ratio_child_fill_content_width() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { aspect_ratio: Some(2f32), ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HHHH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - Some(2f32), - ) - }), + crate::TextMeasure { + text_content: "HHHH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: Some(2f32), + }, ) .unwrap(); let node1 = taffy @@ -30,9 +25,9 @@ fn grid_aspect_ratio_child_fill_content_width() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); diff --git a/tests/generated/grid/grid_aspect_ratio_fill_child_height.rs b/tests/generated/grid/grid_aspect_ratio_fill_child_height.rs index 9b8c08aed..16b26e604 100644 --- a/tests/generated/grid/grid_aspect_ratio_fill_child_height.rs +++ b/tests/generated/grid/grid_aspect_ratio_fill_child_height.rs @@ -1,8 +1,8 @@ #[test] fn grid_aspect_ratio_fill_child_height() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Length(50f32), height: auto() }, @@ -23,9 +23,9 @@ fn grid_aspect_ratio_fill_child_height() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/grid/grid_aspect_ratio_fill_child_max_height.rs b/tests/generated/grid/grid_aspect_ratio_fill_child_max_height.rs index 6da6ece1d..e941eaecc 100644 --- a/tests/generated/grid/grid_aspect_ratio_fill_child_max_height.rs +++ b/tests/generated/grid/grid_aspect_ratio_fill_child_max_height.rs @@ -1,25 +1,20 @@ #[test] fn grid_aspect_ratio_fill_child_max_height() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { max_size: taffy::geometry::Size { width: taffy::style::Dimension::Length(40f32), height: auto() }, aspect_ratio: Some(2f32), ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Vertical, - Some(2f32), - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH", + writing_mode: crate::WritingMode::Vertical, + _aspect_ratio: Some(2f32), + }, ) .unwrap(); let node = taffy @@ -35,9 +30,9 @@ fn grid_aspect_ratio_fill_child_max_height() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/grid/grid_aspect_ratio_fill_child_max_width.rs b/tests/generated/grid/grid_aspect_ratio_fill_child_max_width.rs index 022c5eece..f7d6ea76e 100644 --- a/tests/generated/grid/grid_aspect_ratio_fill_child_max_width.rs +++ b/tests/generated/grid/grid_aspect_ratio_fill_child_max_width.rs @@ -1,25 +1,20 @@ #[test] fn grid_aspect_ratio_fill_child_max_width() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(20f32) }, aspect_ratio: Some(2f32), ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH\u{200b}HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - Some(2f32), - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH\u{200b}HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: Some(2f32), + }, ) .unwrap(); let node = taffy @@ -35,9 +30,9 @@ fn grid_aspect_ratio_fill_child_max_width() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/grid/grid_aspect_ratio_fill_child_min_height.rs b/tests/generated/grid/grid_aspect_ratio_fill_child_min_height.rs index edc8b7c28..53f3ebd57 100644 --- a/tests/generated/grid/grid_aspect_ratio_fill_child_min_height.rs +++ b/tests/generated/grid/grid_aspect_ratio_fill_child_min_height.rs @@ -1,8 +1,8 @@ #[test] fn grid_aspect_ratio_fill_child_min_height() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { min_size: taffy::geometry::Size { width: taffy::style::Dimension::Length(50f32), height: auto() }, @@ -23,9 +23,9 @@ fn grid_aspect_ratio_fill_child_min_height() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/grid/grid_aspect_ratio_fill_child_min_width.rs b/tests/generated/grid/grid_aspect_ratio_fill_child_min_width.rs index e3d67287e..185f8ecbe 100644 --- a/tests/generated/grid/grid_aspect_ratio_fill_child_min_width.rs +++ b/tests/generated/grid/grid_aspect_ratio_fill_child_min_width.rs @@ -1,25 +1,20 @@ #[test] fn grid_aspect_ratio_fill_child_min_width() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(50f32) }, aspect_ratio: Some(2f32), ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "\n \n "; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - Some(2f32), - ) - }), + crate::TextMeasure { + text_content: "\n \n ", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: Some(2f32), + }, ) .unwrap(); let node = taffy @@ -35,9 +30,9 @@ fn grid_aspect_ratio_fill_child_min_width() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/grid/grid_aspect_ratio_fill_child_width.rs b/tests/generated/grid/grid_aspect_ratio_fill_child_width.rs index 7c7cfa794..74641ec79 100644 --- a/tests/generated/grid/grid_aspect_ratio_fill_child_width.rs +++ b/tests/generated/grid/grid_aspect_ratio_fill_child_width.rs @@ -1,8 +1,8 @@ #[test] fn grid_aspect_ratio_fill_child_width() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Length(50f32) }, @@ -23,9 +23,9 @@ fn grid_aspect_ratio_fill_child_width() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/grid/grid_aspect_ratio_overriden_by_explicit_sizes.rs b/tests/generated/grid/grid_aspect_ratio_overriden_by_explicit_sizes.rs index 6c89ec77e..f42364efb 100644 --- a/tests/generated/grid/grid_aspect_ratio_overriden_by_explicit_sizes.rs +++ b/tests/generated/grid/grid_aspect_ratio_overriden_by_explicit_sizes.rs @@ -1,8 +1,8 @@ #[test] fn grid_aspect_ratio_overriden_by_explicit_sizes() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -26,9 +26,9 @@ fn grid_aspect_ratio_overriden_by_explicit_sizes() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/grid/grid_aspect_ratio_overriden_by_explicit_sizes_flex.rs b/tests/generated/grid/grid_aspect_ratio_overriden_by_explicit_sizes_flex.rs index a6053e45b..7e6ebb3de 100644 --- a/tests/generated/grid/grid_aspect_ratio_overriden_by_explicit_sizes_flex.rs +++ b/tests/generated/grid/grid_aspect_ratio_overriden_by_explicit_sizes_flex.rs @@ -1,8 +1,8 @@ #[test] fn grid_aspect_ratio_overriden_by_explicit_sizes_flex() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -26,9 +26,9 @@ fn grid_aspect_ratio_overriden_by_explicit_sizes_flex() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/grid/grid_auto_columns.rs b/tests/generated/grid/grid_auto_columns.rs index 8c20713a6..26ebcfe8a 100644 --- a/tests/generated/grid/grid_auto_columns.rs +++ b/tests/generated/grid/grid_auto_columns.rs @@ -1,8 +1,8 @@ #[test] fn grid_auto_columns() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { grid_column: taffy::geometry::Line { start: line(-3i16), end: taffy::style::GridPlacement::Auto }, @@ -29,9 +29,9 @@ fn grid_auto_columns() { &[node0, node1, node2, node3, node4, node5, node6, node7], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 190f32, "width of node {:?}. Expected {}. Actual {}", node, 190f32, size.width); diff --git a/tests/generated/grid/grid_auto_columns_fixed_width.rs b/tests/generated/grid/grid_auto_columns_fixed_width.rs index da09c737c..f64b273f5 100644 --- a/tests/generated/grid/grid_auto_columns_fixed_width.rs +++ b/tests/generated/grid/grid_auto_columns_fixed_width.rs @@ -1,8 +1,8 @@ #[test] fn grid_auto_columns_fixed_width() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -37,9 +37,9 @@ fn grid_auto_columns_fixed_width() { ], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/grid/grid_auto_fill_fixed_size.rs b/tests/generated/grid/grid_auto_fill_fixed_size.rs index 4fceedef7..d96a9e83c 100644 --- a/tests/generated/grid/grid_auto_fill_fixed_size.rs +++ b/tests/generated/grid/grid_auto_fill_fixed_size.rs @@ -1,8 +1,8 @@ #[test] fn grid_auto_fill_fixed_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -27,9 +27,9 @@ fn grid_auto_fill_fixed_size() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); diff --git a/tests/generated/grid/grid_auto_fill_with_empty_auto_track.rs b/tests/generated/grid/grid_auto_fill_with_empty_auto_track.rs index 5de22241b..2e6740083 100644 --- a/tests/generated/grid/grid_auto_fill_with_empty_auto_track.rs +++ b/tests/generated/grid/grid_auto_fill_with_empty_auto_track.rs @@ -1,8 +1,8 @@ #[test] fn grid_auto_fill_with_empty_auto_track() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node = taffy @@ -21,9 +21,9 @@ fn grid_auto_fill_with_empty_auto_track() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); diff --git a/tests/generated/grid/grid_auto_fit_with_empty_auto_track.rs b/tests/generated/grid/grid_auto_fit_with_empty_auto_track.rs index e838e9d27..c855e9233 100644 --- a/tests/generated/grid/grid_auto_fit_with_empty_auto_track.rs +++ b/tests/generated/grid/grid_auto_fit_with_empty_auto_track.rs @@ -1,8 +1,8 @@ #[test] fn grid_auto_fit_with_empty_auto_track() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node = taffy @@ -21,9 +21,9 @@ fn grid_auto_fit_with_empty_auto_track() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); diff --git a/tests/generated/grid/grid_auto_rows.rs b/tests/generated/grid/grid_auto_rows.rs index 692120078..314751b87 100644 --- a/tests/generated/grid/grid_auto_rows.rs +++ b/tests/generated/grid/grid_auto_rows.rs @@ -1,8 +1,8 @@ #[test] fn grid_auto_rows() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { grid_row: taffy::geometry::Line { start: line(-4i16), end: taffy::style::GridPlacement::Auto }, @@ -28,9 +28,9 @@ fn grid_auto_rows() { &[node0, node1, node2, node3, node4, node5, node6, node7], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/grid/grid_auto_single_item.rs b/tests/generated/grid/grid_auto_single_item.rs index e8ae54a8f..ea55f8fb7 100644 --- a/tests/generated/grid/grid_auto_single_item.rs +++ b/tests/generated/grid/grid_auto_single_item.rs @@ -1,8 +1,8 @@ #[test] fn grid_auto_single_item() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { @@ -28,9 +28,9 @@ fn grid_auto_single_item() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); diff --git a/tests/generated/grid/grid_auto_single_item_fixed_width.rs b/tests/generated/grid/grid_auto_single_item_fixed_width.rs index 17b964f22..f9566cb6b 100644 --- a/tests/generated/grid/grid_auto_single_item_fixed_width.rs +++ b/tests/generated/grid/grid_auto_single_item_fixed_width.rs @@ -1,8 +1,8 @@ #[test] fn grid_auto_single_item_fixed_width() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { @@ -29,9 +29,9 @@ fn grid_auto_single_item_fixed_width() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/grid/grid_auto_single_item_fixed_width_with_definite_width.rs b/tests/generated/grid/grid_auto_single_item_fixed_width_with_definite_width.rs index b780cadc8..d33049dfc 100644 --- a/tests/generated/grid/grid_auto_single_item_fixed_width_with_definite_width.rs +++ b/tests/generated/grid/grid_auto_single_item_fixed_width_with_definite_width.rs @@ -1,8 +1,8 @@ #[test] fn grid_auto_single_item_fixed_width_with_definite_width() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { @@ -29,9 +29,9 @@ fn grid_auto_single_item_fixed_width_with_definite_width() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/grid/grid_auto_takes_precedence_over_fr.rs b/tests/generated/grid/grid_auto_takes_precedence_over_fr.rs index a2ed9dd92..f17991a0d 100644 --- a/tests/generated/grid/grid_auto_takes_precedence_over_fr.rs +++ b/tests/generated/grid/grid_auto_takes_precedence_over_fr.rs @@ -1,8 +1,8 @@ #[test] fn grid_auto_takes_precedence_over_fr() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node = taffy @@ -20,9 +20,9 @@ fn grid_auto_takes_precedence_over_fr() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/grid/grid_available_space_greater_than_max_content.rs b/tests/generated/grid/grid_available_space_greater_than_max_content.rs index aa4076ef6..6630b3505 100644 --- a/tests/generated/grid/grid_available_space_greater_than_max_content.rs +++ b/tests/generated/grid/grid_available_space_greater_than_max_content.rs @@ -1,36 +1,26 @@ #[test] fn grid_available_space_greater_than_max_content() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH\u{200b}HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH\u{200b}HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node1 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH\u{200b}HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH\u{200b}HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -44,16 +34,17 @@ fn grid_available_space_greater_than_max_content() { ) .unwrap(); taffy - .compute_layout( + .compute_layout_with_measure( node, taffy::geometry::Size { width: taffy::style::AvailableSpace::Definite(400f32), height: taffy::style::AvailableSpace::MaxContent, }, + crate::test_measure_function, ) .unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node, 160f32, size.width); diff --git a/tests/generated/grid/grid_available_space_smaller_than_max_content.rs b/tests/generated/grid/grid_available_space_smaller_than_max_content.rs index 437d4fa52..12686f830 100644 --- a/tests/generated/grid/grid_available_space_smaller_than_max_content.rs +++ b/tests/generated/grid/grid_available_space_smaller_than_max_content.rs @@ -1,36 +1,26 @@ #[test] fn grid_available_space_smaller_than_max_content() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH\u{200b}HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH\u{200b}HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node1 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH\u{200b}HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH\u{200b}HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -44,16 +34,17 @@ fn grid_available_space_smaller_than_max_content() { ) .unwrap(); taffy - .compute_layout( + .compute_layout_with_measure( node, taffy::geometry::Size { width: taffy::style::AvailableSpace::Definite(80f32), height: taffy::style::AvailableSpace::MaxContent, }, + crate::test_measure_function, ) .unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); diff --git a/tests/generated/grid/grid_available_space_smaller_than_min_content.rs b/tests/generated/grid/grid_available_space_smaller_than_min_content.rs index a69cc56c8..6100b93f5 100644 --- a/tests/generated/grid/grid_available_space_smaller_than_min_content.rs +++ b/tests/generated/grid/grid_available_space_smaller_than_min_content.rs @@ -1,36 +1,26 @@ #[test] fn grid_available_space_smaller_than_min_content() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HHHH\u{200b}HHHH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HHHH\u{200b}HHHH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node1 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HHHH\u{200b}HHHH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HHHH\u{200b}HHHH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -44,16 +34,17 @@ fn grid_available_space_smaller_than_min_content() { ) .unwrap(); taffy - .compute_layout( + .compute_layout_with_measure( node, taffy::geometry::Size { width: taffy::style::AvailableSpace::Definite(60f32), height: taffy::style::AvailableSpace::MaxContent, }, + crate::test_measure_function, ) .unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); diff --git a/tests/generated/grid/grid_basic.rs b/tests/generated/grid/grid_basic.rs index 116cb81f5..e3390e13e 100644 --- a/tests/generated/grid/grid_basic.rs +++ b/tests/generated/grid/grid_basic.rs @@ -1,8 +1,8 @@ #[test] fn grid_basic() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -27,9 +27,9 @@ fn grid_basic() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); diff --git a/tests/generated/grid/grid_basic_implicit_tracks.rs b/tests/generated/grid/grid_basic_implicit_tracks.rs index 4b4477cc8..d2849f86f 100644 --- a/tests/generated/grid/grid_basic_implicit_tracks.rs +++ b/tests/generated/grid/grid_basic_implicit_tracks.rs @@ -1,8 +1,8 @@ #[test] fn grid_basic_implicit_tracks() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { @@ -24,9 +24,9 @@ fn grid_basic_implicit_tracks() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); diff --git a/tests/generated/grid/grid_basic_with_overflow.rs b/tests/generated/grid/grid_basic_with_overflow.rs index e358a0c86..407729efd 100644 --- a/tests/generated/grid/grid_basic_with_overflow.rs +++ b/tests/generated/grid/grid_basic_with_overflow.rs @@ -1,8 +1,8 @@ #[test] fn grid_basic_with_overflow() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -28,9 +28,9 @@ fn grid_basic_with_overflow() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8, node9], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); diff --git a/tests/generated/grid/grid_basic_with_padding.rs b/tests/generated/grid/grid_basic_with_padding.rs index a36d6df59..bbf8eaf9e 100644 --- a/tests/generated/grid/grid_basic_with_padding.rs +++ b/tests/generated/grid/grid_basic_with_padding.rs @@ -1,8 +1,8 @@ #[test] fn grid_basic_with_padding() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -29,9 +29,9 @@ fn grid_basic_with_padding() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); diff --git a/tests/generated/grid/grid_display_none_fixed_size.rs b/tests/generated/grid/grid_display_none_fixed_size.rs index 4e6b86f8c..73a3d0aed 100644 --- a/tests/generated/grid/grid_display_none_fixed_size.rs +++ b/tests/generated/grid/grid_display_none_fixed_size.rs @@ -1,8 +1,8 @@ #[test] fn grid_display_none_fixed_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { flex_grow: 1f32, ..Default::default() }).unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { @@ -27,9 +27,9 @@ fn grid_display_none_fixed_size() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/grid/grid_fit_content_percent_definite_argument.rs b/tests/generated/grid/grid_fit_content_percent_definite_argument.rs index ff20cb410..ff09dc8a9 100644 --- a/tests/generated/grid/grid_fit_content_percent_definite_argument.rs +++ b/tests/generated/grid/grid_fit_content_percent_definite_argument.rs @@ -1,21 +1,16 @@ #[test] fn grid_fit_content_percent_definite_argument() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -30,9 +25,9 @@ fn grid_fit_content_percent_definite_argument() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); diff --git a/tests/generated/grid/grid_fit_content_percent_definite_max_content.rs b/tests/generated/grid/grid_fit_content_percent_definite_max_content.rs index d01c7649e..5a691f9c1 100644 --- a/tests/generated/grid/grid_fit_content_percent_definite_max_content.rs +++ b/tests/generated/grid/grid_fit_content_percent_definite_max_content.rs @@ -1,21 +1,16 @@ #[test] fn grid_fit_content_percent_definite_max_content() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -30,9 +25,9 @@ fn grid_fit_content_percent_definite_max_content() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); diff --git a/tests/generated/grid/grid_fit_content_percent_definite_min_content.rs b/tests/generated/grid/grid_fit_content_percent_definite_min_content.rs index 8ad390570..ed2065057 100644 --- a/tests/generated/grid/grid_fit_content_percent_definite_min_content.rs +++ b/tests/generated/grid/grid_fit_content_percent_definite_min_content.rs @@ -1,21 +1,16 @@ #[test] fn grid_fit_content_percent_definite_min_content() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HHHH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HHHH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -30,9 +25,9 @@ fn grid_fit_content_percent_definite_min_content() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); diff --git a/tests/generated/grid/grid_fit_content_percent_indefinite_argument.rs b/tests/generated/grid/grid_fit_content_percent_indefinite_argument.rs index 9c134e099..26a9fe57f 100644 --- a/tests/generated/grid/grid_fit_content_percent_indefinite_argument.rs +++ b/tests/generated/grid/grid_fit_content_percent_indefinite_argument.rs @@ -1,21 +1,16 @@ #[test] fn grid_fit_content_percent_indefinite_argument() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -29,9 +24,9 @@ fn grid_fit_content_percent_indefinite_argument() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); diff --git a/tests/generated/grid/grid_fit_content_percent_indefinite_max_content.rs b/tests/generated/grid/grid_fit_content_percent_indefinite_max_content.rs index 39cb4a43d..1f9789f77 100644 --- a/tests/generated/grid/grid_fit_content_percent_indefinite_max_content.rs +++ b/tests/generated/grid/grid_fit_content_percent_indefinite_max_content.rs @@ -1,21 +1,16 @@ #[test] fn grid_fit_content_percent_indefinite_max_content() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -29,9 +24,9 @@ fn grid_fit_content_percent_indefinite_max_content() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); diff --git a/tests/generated/grid/grid_fit_content_percent_indefinite_max_content_hidden.rs b/tests/generated/grid/grid_fit_content_percent_indefinite_max_content_hidden.rs index 3f5abfb25..d34a5c991 100644 --- a/tests/generated/grid/grid_fit_content_percent_indefinite_max_content_hidden.rs +++ b/tests/generated/grid/grid_fit_content_percent_indefinite_max_content_hidden.rs @@ -1,10 +1,10 @@ #[test] fn grid_fit_content_percent_indefinite_max_content_hidden() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { overflow: taffy::geometry::Point { x: taffy::style::Overflow::Hidden, @@ -13,16 +13,11 @@ fn grid_fit_content_percent_indefinite_max_content_hidden() { scrollbar_width: 15f32, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -36,9 +31,9 @@ fn grid_fit_content_percent_indefinite_max_content_hidden() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); diff --git a/tests/generated/grid/grid_fit_content_percent_indefinite_min_content.rs b/tests/generated/grid/grid_fit_content_percent_indefinite_min_content.rs index 02b55c94b..31e4331e9 100644 --- a/tests/generated/grid/grid_fit_content_percent_indefinite_min_content.rs +++ b/tests/generated/grid/grid_fit_content_percent_indefinite_min_content.rs @@ -1,21 +1,16 @@ #[test] fn grid_fit_content_percent_indefinite_min_content() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HHHH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HHHH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -29,9 +24,9 @@ fn grid_fit_content_percent_indefinite_min_content() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); diff --git a/tests/generated/grid/grid_fit_content_percent_indefinite_min_content_hidden.rs b/tests/generated/grid/grid_fit_content_percent_indefinite_min_content_hidden.rs index 40c311282..391257248 100644 --- a/tests/generated/grid/grid_fit_content_percent_indefinite_min_content_hidden.rs +++ b/tests/generated/grid/grid_fit_content_percent_indefinite_min_content_hidden.rs @@ -1,10 +1,10 @@ #[test] fn grid_fit_content_percent_indefinite_min_content_hidden() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { overflow: taffy::geometry::Point { x: taffy::style::Overflow::Hidden, @@ -13,16 +13,11 @@ fn grid_fit_content_percent_indefinite_min_content_hidden() { scrollbar_width: 15f32, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HHHH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HHHH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -36,9 +31,9 @@ fn grid_fit_content_percent_indefinite_min_content_hidden() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); diff --git a/tests/generated/grid/grid_fit_content_points_argument.rs b/tests/generated/grid/grid_fit_content_points_argument.rs index 5b0eed81c..e018896b9 100644 --- a/tests/generated/grid/grid_fit_content_points_argument.rs +++ b/tests/generated/grid/grid_fit_content_points_argument.rs @@ -1,21 +1,16 @@ #[test] fn grid_fit_content_points_argument() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -29,9 +24,9 @@ fn grid_fit_content_points_argument() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node, 30f32, size.width); diff --git a/tests/generated/grid/grid_fit_content_points_max_content.rs b/tests/generated/grid/grid_fit_content_points_max_content.rs index 8c165dc08..e2a91d056 100644 --- a/tests/generated/grid/grid_fit_content_points_max_content.rs +++ b/tests/generated/grid/grid_fit_content_points_max_content.rs @@ -1,21 +1,16 @@ #[test] fn grid_fit_content_points_max_content() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -29,9 +24,9 @@ fn grid_fit_content_points_max_content() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); diff --git a/tests/generated/grid/grid_fit_content_points_min_content.rs b/tests/generated/grid/grid_fit_content_points_min_content.rs index f972a6e76..5bd31fdfd 100644 --- a/tests/generated/grid/grid_fit_content_points_min_content.rs +++ b/tests/generated/grid/grid_fit_content_points_min_content.rs @@ -1,21 +1,16 @@ #[test] fn grid_fit_content_points_min_content() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HHHH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HHHH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -29,9 +24,9 @@ fn grid_fit_content_points_min_content() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); diff --git a/tests/generated/grid/grid_fit_content_points_min_content_hidden.rs b/tests/generated/grid/grid_fit_content_points_min_content_hidden.rs index 42af6c6b8..61aa8cb59 100644 --- a/tests/generated/grid/grid_fit_content_points_min_content_hidden.rs +++ b/tests/generated/grid/grid_fit_content_points_min_content_hidden.rs @@ -1,10 +1,10 @@ #[test] fn grid_fit_content_points_min_content_hidden() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { overflow: taffy::geometry::Point { x: taffy::style::Overflow::Hidden, @@ -13,16 +13,11 @@ fn grid_fit_content_points_min_content_hidden() { scrollbar_width: 15f32, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HHHH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HHHH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -36,9 +31,9 @@ fn grid_fit_content_points_min_content_hidden() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node, 30f32, size.width); diff --git a/tests/generated/grid/grid_fr_fixed_size_no_content_proportions.rs b/tests/generated/grid/grid_fr_fixed_size_no_content_proportions.rs index e34d114e8..94d07539c 100644 --- a/tests/generated/grid/grid_fr_fixed_size_no_content_proportions.rs +++ b/tests/generated/grid/grid_fr_fixed_size_no_content_proportions.rs @@ -1,8 +1,8 @@ #[test] fn grid_fr_fixed_size_no_content_proportions() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -18,9 +18,9 @@ fn grid_fr_fixed_size_no_content_proportions() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/grid/grid_fr_fixed_size_no_content_proportions_sub_1_sum.rs b/tests/generated/grid/grid_fr_fixed_size_no_content_proportions_sub_1_sum.rs index ca839fd4a..9e2c3ae4d 100644 --- a/tests/generated/grid/grid_fr_fixed_size_no_content_proportions_sub_1_sum.rs +++ b/tests/generated/grid/grid_fr_fixed_size_no_content_proportions_sub_1_sum.rs @@ -1,8 +1,8 @@ #[test] fn grid_fr_fixed_size_no_content_proportions_sub_1_sum() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node = taffy @@ -17,9 +17,9 @@ fn grid_fr_fixed_size_no_content_proportions_sub_1_sum() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/grid/grid_fr_fixed_size_single_item.rs b/tests/generated/grid/grid_fr_fixed_size_single_item.rs index a34d1eb13..6564eba8f 100644 --- a/tests/generated/grid/grid_fr_fixed_size_single_item.rs +++ b/tests/generated/grid/grid_fr_fixed_size_single_item.rs @@ -1,8 +1,8 @@ #[test] fn grid_fr_fixed_size_single_item() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -32,9 +32,9 @@ fn grid_fr_fixed_size_single_item() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/grid/grid_fr_no_sized_items_indefinite.rs b/tests/generated/grid/grid_fr_no_sized_items_indefinite.rs index 58b2ef73d..d9592623a 100644 --- a/tests/generated/grid/grid_fr_no_sized_items_indefinite.rs +++ b/tests/generated/grid/grid_fr_no_sized_items_indefinite.rs @@ -1,8 +1,8 @@ #[test] fn grid_fr_no_sized_items_indefinite() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -23,9 +23,9 @@ fn grid_fr_no_sized_items_indefinite() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); diff --git a/tests/generated/grid/grid_fr_single_item_indefinite.rs b/tests/generated/grid/grid_fr_single_item_indefinite.rs index 8de1c863d..195cd03a5 100644 --- a/tests/generated/grid/grid_fr_single_item_indefinite.rs +++ b/tests/generated/grid/grid_fr_single_item_indefinite.rs @@ -1,8 +1,8 @@ #[test] fn grid_fr_single_item_indefinite() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { @@ -32,9 +32,9 @@ fn grid_fr_single_item_indefinite() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 240f32, "width of node {:?}. Expected {}. Actual {}", node, 240f32, size.width); diff --git a/tests/generated/grid/grid_fr_span_2_proportion.rs b/tests/generated/grid/grid_fr_span_2_proportion.rs index 5886c7924..5734a2151 100644 --- a/tests/generated/grid/grid_fr_span_2_proportion.rs +++ b/tests/generated/grid/grid_fr_span_2_proportion.rs @@ -1,8 +1,8 @@ #[test] fn grid_fr_span_2_proportion() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { grid_column: taffy::geometry::Line { @@ -26,9 +26,9 @@ fn grid_fr_span_2_proportion() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); diff --git a/tests/generated/grid/grid_fr_span_2_proportion_sub_1_sum.rs b/tests/generated/grid/grid_fr_span_2_proportion_sub_1_sum.rs index 7768a86af..28f9c79da 100644 --- a/tests/generated/grid/grid_fr_span_2_proportion_sub_1_sum.rs +++ b/tests/generated/grid/grid_fr_span_2_proportion_sub_1_sum.rs @@ -1,8 +1,8 @@ #[test] fn grid_fr_span_2_proportion_sub_1_sum() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { grid_column: taffy::geometry::Line { @@ -26,9 +26,9 @@ fn grid_fr_span_2_proportion_sub_1_sum() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); diff --git a/tests/generated/grid/grid_fr_span_2_proportion_with_non_spanned_track.rs b/tests/generated/grid/grid_fr_span_2_proportion_with_non_spanned_track.rs index 90df6a552..200671e73 100644 --- a/tests/generated/grid/grid_fr_span_2_proportion_with_non_spanned_track.rs +++ b/tests/generated/grid/grid_fr_span_2_proportion_with_non_spanned_track.rs @@ -1,8 +1,8 @@ #[test] fn grid_fr_span_2_proportion_with_non_spanned_track() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { grid_column: taffy::geometry::Line { @@ -28,9 +28,9 @@ fn grid_fr_span_2_proportion_with_non_spanned_track() { &[node0, node1, node2, node3, node4], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); diff --git a/tests/generated/grid/grid_fr_span_2_proportion_zero_sum.rs b/tests/generated/grid/grid_fr_span_2_proportion_zero_sum.rs index 2d83227d4..9bc0a10ef 100644 --- a/tests/generated/grid/grid_fr_span_2_proportion_zero_sum.rs +++ b/tests/generated/grid/grid_fr_span_2_proportion_zero_sum.rs @@ -1,8 +1,8 @@ #[test] fn grid_fr_span_2_proportion_zero_sum() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { grid_column: taffy::geometry::Line { @@ -26,9 +26,9 @@ fn grid_fr_span_2_proportion_zero_sum() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); diff --git a/tests/generated/grid/grid_fr_span_2_proportion_zero_sum_with_non_spanned_track.rs b/tests/generated/grid/grid_fr_span_2_proportion_zero_sum_with_non_spanned_track.rs index 5465724e4..480758c34 100644 --- a/tests/generated/grid/grid_fr_span_2_proportion_zero_sum_with_non_spanned_track.rs +++ b/tests/generated/grid/grid_fr_span_2_proportion_zero_sum_with_non_spanned_track.rs @@ -1,8 +1,8 @@ #[test] fn grid_fr_span_2_proportion_zero_sum_with_non_spanned_track() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { grid_column: taffy::geometry::Line { @@ -28,9 +28,9 @@ fn grid_fr_span_2_proportion_zero_sum_with_non_spanned_track() { &[node0, node1, node2, node3, node4], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); diff --git a/tests/generated/grid/grid_gap.rs b/tests/generated/grid/grid_gap.rs index 1d6fbf663..c3a24d14a 100644 --- a/tests/generated/grid/grid_gap.rs +++ b/tests/generated/grid/grid_gap.rs @@ -1,8 +1,8 @@ #[test] fn grid_gap() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -31,9 +31,9 @@ fn grid_gap() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/grid/grid_hidden.rs b/tests/generated/grid/grid_hidden.rs index b2ac34dca..a3e047161 100644 --- a/tests/generated/grid/grid_hidden.rs +++ b/tests/generated/grid/grid_hidden.rs @@ -1,8 +1,8 @@ #[test] fn grid_hidden() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy.new_leaf(taffy::style::Style { display: taffy::style::Display::None, ..Default::default() }).unwrap(); @@ -30,9 +30,9 @@ fn grid_hidden() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); diff --git a/tests/generated/grid/grid_justify_content_center.rs b/tests/generated/grid/grid_justify_content_center.rs index db5de6c9c..9a289855d 100644 --- a/tests/generated/grid/grid_justify_content_center.rs +++ b/tests/generated/grid/grid_justify_content_center.rs @@ -1,8 +1,8 @@ #[test] fn grid_justify_content_center() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -28,9 +28,9 @@ fn grid_justify_content_center() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/grid/grid_justify_content_center_negative_space_gap.rs b/tests/generated/grid/grid_justify_content_center_negative_space_gap.rs index 1128f082d..47faa3dd4 100644 --- a/tests/generated/grid/grid_justify_content_center_negative_space_gap.rs +++ b/tests/generated/grid/grid_justify_content_center_negative_space_gap.rs @@ -1,8 +1,8 @@ #[test] fn grid_justify_content_center_negative_space_gap() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node01 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node02 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -52,9 +52,9 @@ fn grid_justify_content_center_negative_space_gap() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 240f32, "width of node {:?}. Expected {}. Actual {}", node, 240f32, size.width); diff --git a/tests/generated/grid/grid_justify_content_center_with_padding_border.rs b/tests/generated/grid/grid_justify_content_center_with_padding_border.rs index 436eafe92..3bd99cd83 100644 --- a/tests/generated/grid/grid_justify_content_center_with_padding_border.rs +++ b/tests/generated/grid/grid_justify_content_center_with_padding_border.rs @@ -1,8 +1,8 @@ #[test] fn grid_justify_content_center_with_padding_border() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -40,9 +40,9 @@ fn grid_justify_content_center_with_padding_border() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/grid/grid_justify_content_end.rs b/tests/generated/grid/grid_justify_content_end.rs index a3ef4d553..4aaf3b562 100644 --- a/tests/generated/grid/grid_justify_content_end.rs +++ b/tests/generated/grid/grid_justify_content_end.rs @@ -1,8 +1,8 @@ #[test] fn grid_justify_content_end() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -28,9 +28,9 @@ fn grid_justify_content_end() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/grid/grid_justify_content_end_negative_space_gap.rs b/tests/generated/grid/grid_justify_content_end_negative_space_gap.rs index fd9f7da3b..083579d2a 100644 --- a/tests/generated/grid/grid_justify_content_end_negative_space_gap.rs +++ b/tests/generated/grid/grid_justify_content_end_negative_space_gap.rs @@ -1,8 +1,8 @@ #[test] fn grid_justify_content_end_negative_space_gap() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node01 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node02 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -52,9 +52,9 @@ fn grid_justify_content_end_negative_space_gap() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 240f32, "width of node {:?}. Expected {}. Actual {}", node, 240f32, size.width); diff --git a/tests/generated/grid/grid_justify_content_end_with_padding_border.rs b/tests/generated/grid/grid_justify_content_end_with_padding_border.rs index d5f48637d..4980ee120 100644 --- a/tests/generated/grid/grid_justify_content_end_with_padding_border.rs +++ b/tests/generated/grid/grid_justify_content_end_with_padding_border.rs @@ -1,8 +1,8 @@ #[test] fn grid_justify_content_end_with_padding_border() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -40,9 +40,9 @@ fn grid_justify_content_end_with_padding_border() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/grid/grid_justify_content_space_around.rs b/tests/generated/grid/grid_justify_content_space_around.rs index 64f4a628b..6ac65fcc6 100644 --- a/tests/generated/grid/grid_justify_content_space_around.rs +++ b/tests/generated/grid/grid_justify_content_space_around.rs @@ -1,8 +1,8 @@ #[test] fn grid_justify_content_space_around() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -28,9 +28,9 @@ fn grid_justify_content_space_around() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/grid/grid_justify_content_space_around_negative_space_gap.rs b/tests/generated/grid/grid_justify_content_space_around_negative_space_gap.rs index 9000c2a27..17617b705 100644 --- a/tests/generated/grid/grid_justify_content_space_around_negative_space_gap.rs +++ b/tests/generated/grid/grid_justify_content_space_around_negative_space_gap.rs @@ -1,8 +1,8 @@ #[test] fn grid_justify_content_space_around_negative_space_gap() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node01 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node02 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -52,9 +52,9 @@ fn grid_justify_content_space_around_negative_space_gap() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 240f32, "width of node {:?}. Expected {}. Actual {}", node, 240f32, size.width); diff --git a/tests/generated/grid/grid_justify_content_space_around_with_padding_border.rs b/tests/generated/grid/grid_justify_content_space_around_with_padding_border.rs index f7a2d8892..c5f6ebc09 100644 --- a/tests/generated/grid/grid_justify_content_space_around_with_padding_border.rs +++ b/tests/generated/grid/grid_justify_content_space_around_with_padding_border.rs @@ -1,8 +1,8 @@ #[test] fn grid_justify_content_space_around_with_padding_border() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -40,9 +40,9 @@ fn grid_justify_content_space_around_with_padding_border() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/grid/grid_justify_content_space_between.rs b/tests/generated/grid/grid_justify_content_space_between.rs index 0cb9375d4..f80305cc5 100644 --- a/tests/generated/grid/grid_justify_content_space_between.rs +++ b/tests/generated/grid/grid_justify_content_space_between.rs @@ -1,8 +1,8 @@ #[test] fn grid_justify_content_space_between() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -28,9 +28,9 @@ fn grid_justify_content_space_between() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/grid/grid_justify_content_space_between_negative_space_gap.rs b/tests/generated/grid/grid_justify_content_space_between_negative_space_gap.rs index 20f70f93a..cc6347789 100644 --- a/tests/generated/grid/grid_justify_content_space_between_negative_space_gap.rs +++ b/tests/generated/grid/grid_justify_content_space_between_negative_space_gap.rs @@ -1,8 +1,8 @@ #[test] fn grid_justify_content_space_between_negative_space_gap() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node01 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node02 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -52,9 +52,9 @@ fn grid_justify_content_space_between_negative_space_gap() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 240f32, "width of node {:?}. Expected {}. Actual {}", node, 240f32, size.width); diff --git a/tests/generated/grid/grid_justify_content_space_between_with_padding_border.rs b/tests/generated/grid/grid_justify_content_space_between_with_padding_border.rs index 3bf647ad4..bca0c3c64 100644 --- a/tests/generated/grid/grid_justify_content_space_between_with_padding_border.rs +++ b/tests/generated/grid/grid_justify_content_space_between_with_padding_border.rs @@ -1,8 +1,8 @@ #[test] fn grid_justify_content_space_between_with_padding_border() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -40,9 +40,9 @@ fn grid_justify_content_space_between_with_padding_border() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/grid/grid_justify_content_space_evenly.rs b/tests/generated/grid/grid_justify_content_space_evenly.rs index 94f8833a4..48a591ff4 100644 --- a/tests/generated/grid/grid_justify_content_space_evenly.rs +++ b/tests/generated/grid/grid_justify_content_space_evenly.rs @@ -1,8 +1,8 @@ #[test] fn grid_justify_content_space_evenly() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -28,9 +28,9 @@ fn grid_justify_content_space_evenly() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/grid/grid_justify_content_space_evenly_negative_space_gap.rs b/tests/generated/grid/grid_justify_content_space_evenly_negative_space_gap.rs index 81a02cc4a..5d7e22e3a 100644 --- a/tests/generated/grid/grid_justify_content_space_evenly_negative_space_gap.rs +++ b/tests/generated/grid/grid_justify_content_space_evenly_negative_space_gap.rs @@ -1,8 +1,8 @@ #[test] fn grid_justify_content_space_evenly_negative_space_gap() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node01 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node02 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -52,9 +52,9 @@ fn grid_justify_content_space_evenly_negative_space_gap() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 240f32, "width of node {:?}. Expected {}. Actual {}", node, 240f32, size.width); diff --git a/tests/generated/grid/grid_justify_content_space_evenly_with_padding_border.rs b/tests/generated/grid/grid_justify_content_space_evenly_with_padding_border.rs index 18762c8fe..f05d317e6 100644 --- a/tests/generated/grid/grid_justify_content_space_evenly_with_padding_border.rs +++ b/tests/generated/grid/grid_justify_content_space_evenly_with_padding_border.rs @@ -1,8 +1,8 @@ #[test] fn grid_justify_content_space_evenly_with_padding_border() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -40,9 +40,9 @@ fn grid_justify_content_space_evenly_with_padding_border() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/grid/grid_justify_content_start.rs b/tests/generated/grid/grid_justify_content_start.rs index b410af698..9de274f2a 100644 --- a/tests/generated/grid/grid_justify_content_start.rs +++ b/tests/generated/grid/grid_justify_content_start.rs @@ -1,8 +1,8 @@ #[test] fn grid_justify_content_start() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -28,9 +28,9 @@ fn grid_justify_content_start() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/grid/grid_justify_content_start_negative_space_gap.rs b/tests/generated/grid/grid_justify_content_start_negative_space_gap.rs index 4d81a62df..42dd1d94c 100644 --- a/tests/generated/grid/grid_justify_content_start_negative_space_gap.rs +++ b/tests/generated/grid/grid_justify_content_start_negative_space_gap.rs @@ -1,8 +1,8 @@ #[test] fn grid_justify_content_start_negative_space_gap() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node01 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node02 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -52,9 +52,9 @@ fn grid_justify_content_start_negative_space_gap() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 240f32, "width of node {:?}. Expected {}. Actual {}", node, 240f32, size.width); diff --git a/tests/generated/grid/grid_justify_content_start_with_padding_border.rs b/tests/generated/grid/grid_justify_content_start_with_padding_border.rs index 56c33c7c8..17b9e3bb3 100644 --- a/tests/generated/grid/grid_justify_content_start_with_padding_border.rs +++ b/tests/generated/grid/grid_justify_content_start_with_padding_border.rs @@ -1,8 +1,8 @@ #[test] fn grid_justify_content_start_with_padding_border() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -40,9 +40,9 @@ fn grid_justify_content_start_with_padding_border() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/grid/grid_justify_items_sized_center.rs b/tests/generated/grid/grid_justify_items_sized_center.rs index 603d88367..c92235573 100644 --- a/tests/generated/grid/grid_justify_items_sized_center.rs +++ b/tests/generated/grid/grid_justify_items_sized_center.rs @@ -1,8 +1,8 @@ #[test] fn grid_justify_items_sized_center() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, @@ -41,9 +41,9 @@ fn grid_justify_items_sized_center() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); diff --git a/tests/generated/grid/grid_justify_items_sized_end.rs b/tests/generated/grid/grid_justify_items_sized_end.rs index a7232c5b6..f9c54dc5a 100644 --- a/tests/generated/grid/grid_justify_items_sized_end.rs +++ b/tests/generated/grid/grid_justify_items_sized_end.rs @@ -1,8 +1,8 @@ #[test] fn grid_justify_items_sized_end() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, @@ -41,9 +41,9 @@ fn grid_justify_items_sized_end() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); diff --git a/tests/generated/grid/grid_justify_items_sized_start.rs b/tests/generated/grid/grid_justify_items_sized_start.rs index b269bcfbf..b69d82800 100644 --- a/tests/generated/grid/grid_justify_items_sized_start.rs +++ b/tests/generated/grid/grid_justify_items_sized_start.rs @@ -1,8 +1,8 @@ #[test] fn grid_justify_items_sized_start() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, @@ -41,9 +41,9 @@ fn grid_justify_items_sized_start() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); diff --git a/tests/generated/grid/grid_justify_items_sized_stretch.rs b/tests/generated/grid/grid_justify_items_sized_stretch.rs index f6e9fc086..cc7c4ca70 100644 --- a/tests/generated/grid/grid_justify_items_sized_stretch.rs +++ b/tests/generated/grid/grid_justify_items_sized_stretch.rs @@ -1,8 +1,8 @@ #[test] fn grid_justify_items_sized_stretch() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, @@ -41,9 +41,9 @@ fn grid_justify_items_sized_stretch() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); diff --git a/tests/generated/grid/grid_justify_self_sized_all.rs b/tests/generated/grid/grid_justify_self_sized_all.rs index b44a12921..c6780e7b4 100644 --- a/tests/generated/grid/grid_justify_self_sized_all.rs +++ b/tests/generated/grid/grid_justify_self_sized_all.rs @@ -1,8 +1,8 @@ #[test] fn grid_justify_self_sized_all() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { justify_self: Some(taffy::style::JustifySelf::Start), @@ -98,9 +98,9 @@ fn grid_justify_self_sized_all() { &[node0, node1, node2, node3, node4, node5, node6, node7], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); diff --git a/tests/generated/grid/grid_margins_auto_margins.rs b/tests/generated/grid/grid_margins_auto_margins.rs index 6b6562550..73859fbf2 100644 --- a/tests/generated/grid/grid_margins_auto_margins.rs +++ b/tests/generated/grid/grid_margins_auto_margins.rs @@ -1,8 +1,8 @@ #[test] fn grid_margins_auto_margins() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node2 = taffy @@ -69,9 +69,9 @@ fn grid_margins_auto_margins() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); diff --git a/tests/generated/grid/grid_margins_auto_margins_override_stretch.rs b/tests/generated/grid/grid_margins_auto_margins_override_stretch.rs index 4ee1cab31..0cee9119b 100644 --- a/tests/generated/grid/grid_margins_auto_margins_override_stretch.rs +++ b/tests/generated/grid/grid_margins_auto_margins_override_stretch.rs @@ -1,8 +1,8 @@ #[test] fn grid_margins_auto_margins_override_stretch() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -10,7 +10,7 @@ fn grid_margins_auto_margins_override_stretch() { let node4 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node5 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node6 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { align_self: Some(taffy::style::AlignSelf::Stretch), justify_self: Some(taffy::style::JustifySelf::Stretch), @@ -22,16 +22,11 @@ fn grid_margins_auto_margins_override_stretch() { }, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -53,9 +48,9 @@ fn grid_margins_auto_margins_override_stretch() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); diff --git a/tests/generated/grid/grid_margins_fixed_center.rs b/tests/generated/grid/grid_margins_fixed_center.rs index 08df514b6..1172b29cc 100644 --- a/tests/generated/grid/grid_margins_fixed_center.rs +++ b/tests/generated/grid/grid_margins_fixed_center.rs @@ -1,8 +1,8 @@ #[test] fn grid_margins_fixed_center() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { align_self: Some(taffy::style::AlignSelf::Center), @@ -42,9 +42,9 @@ fn grid_margins_fixed_center() { &[node0, node1, node2, node3, node4, node5], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); diff --git a/tests/generated/grid/grid_margins_fixed_end.rs b/tests/generated/grid/grid_margins_fixed_end.rs index e4177f1e7..929a74084 100644 --- a/tests/generated/grid/grid_margins_fixed_end.rs +++ b/tests/generated/grid/grid_margins_fixed_end.rs @@ -1,8 +1,8 @@ #[test] fn grid_margins_fixed_end() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { align_self: Some(taffy::style::AlignSelf::End), @@ -42,9 +42,9 @@ fn grid_margins_fixed_end() { &[node0, node1, node2, node3, node4, node5], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); diff --git a/tests/generated/grid/grid_margins_fixed_start.rs b/tests/generated/grid/grid_margins_fixed_start.rs index a714cd415..3bec36906 100644 --- a/tests/generated/grid/grid_margins_fixed_start.rs +++ b/tests/generated/grid/grid_margins_fixed_start.rs @@ -1,8 +1,8 @@ #[test] fn grid_margins_fixed_start() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { align_self: Some(taffy::style::AlignSelf::Start), @@ -42,9 +42,9 @@ fn grid_margins_fixed_start() { &[node0, node1, node2, node3, node4, node5], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); diff --git a/tests/generated/grid/grid_margins_fixed_stretch.rs b/tests/generated/grid/grid_margins_fixed_stretch.rs index 628afef32..06981e6dc 100644 --- a/tests/generated/grid/grid_margins_fixed_stretch.rs +++ b/tests/generated/grid/grid_margins_fixed_stretch.rs @@ -1,8 +1,8 @@ #[test] fn grid_margins_fixed_stretch() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { align_self: Some(taffy::style::AlignSelf::Stretch), @@ -42,9 +42,9 @@ fn grid_margins_fixed_stretch() { &[node0, node1, node2, node3, node4, node5], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); diff --git a/tests/generated/grid/grid_margins_percent_center.rs b/tests/generated/grid/grid_margins_percent_center.rs index fc8dd7bef..bc9c9f249 100644 --- a/tests/generated/grid/grid_margins_percent_center.rs +++ b/tests/generated/grid/grid_margins_percent_center.rs @@ -1,8 +1,8 @@ #[test] fn grid_margins_percent_center() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { align_self: Some(taffy::style::AlignSelf::Center), @@ -36,9 +36,9 @@ fn grid_margins_percent_center() { &[node0, node1, node2, node3, node4, node5], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); diff --git a/tests/generated/grid/grid_margins_percent_end.rs b/tests/generated/grid/grid_margins_percent_end.rs index 359d75b13..3ecf81b24 100644 --- a/tests/generated/grid/grid_margins_percent_end.rs +++ b/tests/generated/grid/grid_margins_percent_end.rs @@ -1,8 +1,8 @@ #[test] fn grid_margins_percent_end() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { align_self: Some(taffy::style::AlignSelf::End), @@ -36,9 +36,9 @@ fn grid_margins_percent_end() { &[node0, node1, node2, node3, node4, node5], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); diff --git a/tests/generated/grid/grid_margins_percent_start.rs b/tests/generated/grid/grid_margins_percent_start.rs index fa73ec6d3..7a8d2bc88 100644 --- a/tests/generated/grid/grid_margins_percent_start.rs +++ b/tests/generated/grid/grid_margins_percent_start.rs @@ -1,8 +1,8 @@ #[test] fn grid_margins_percent_start() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { align_self: Some(taffy::style::AlignSelf::Start), @@ -36,9 +36,9 @@ fn grid_margins_percent_start() { &[node0, node1, node2, node3, node4, node5], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); diff --git a/tests/generated/grid/grid_margins_percent_stretch.rs b/tests/generated/grid/grid_margins_percent_stretch.rs index 37d9d6fe0..53dd98d53 100644 --- a/tests/generated/grid/grid_margins_percent_stretch.rs +++ b/tests/generated/grid/grid_margins_percent_stretch.rs @@ -1,8 +1,8 @@ #[test] fn grid_margins_percent_stretch() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { align_self: Some(taffy::style::AlignSelf::Stretch), @@ -36,9 +36,9 @@ fn grid_margins_percent_stretch() { &[node0, node1, node2, node3, node4, node5], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); diff --git a/tests/generated/grid/grid_max_content_maximum_single_item.rs b/tests/generated/grid/grid_max_content_maximum_single_item.rs index dee4c94ea..be1757904 100644 --- a/tests/generated/grid/grid_max_content_maximum_single_item.rs +++ b/tests/generated/grid/grid_max_content_maximum_single_item.rs @@ -1,22 +1,17 @@ #[test] fn grid_max_content_maximum_single_item() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -37,9 +32,9 @@ fn grid_max_content_maximum_single_item() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); diff --git a/tests/generated/grid/grid_max_content_single_item.rs b/tests/generated/grid/grid_max_content_single_item.rs index 955aad3c7..717684d4a 100644 --- a/tests/generated/grid/grid_max_content_single_item.rs +++ b/tests/generated/grid/grid_max_content_single_item.rs @@ -1,22 +1,17 @@ #[test] fn grid_max_content_single_item() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -37,9 +32,9 @@ fn grid_max_content_single_item() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); diff --git a/tests/generated/grid/grid_max_content_single_item_margin_auto.rs b/tests/generated/grid/grid_max_content_single_item_margin_auto.rs index 31efee2d7..9dcd74483 100644 --- a/tests/generated/grid/grid_max_content_single_item_margin_auto.rs +++ b/tests/generated/grid/grid_max_content_single_item_margin_auto.rs @@ -1,11 +1,11 @@ #[test] fn grid_max_content_single_item_margin_auto() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { margin: taffy::geometry::Rect { left: taffy::style::LengthPercentageAuto::Auto, @@ -15,16 +15,11 @@ fn grid_max_content_single_item_margin_auto() { }, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -45,9 +40,9 @@ fn grid_max_content_single_item_margin_auto() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); diff --git a/tests/generated/grid/grid_max_content_single_item_margin_fixed.rs b/tests/generated/grid/grid_max_content_single_item_margin_fixed.rs index c4ef5daad..70289f1f0 100644 --- a/tests/generated/grid/grid_max_content_single_item_margin_fixed.rs +++ b/tests/generated/grid/grid_max_content_single_item_margin_fixed.rs @@ -1,11 +1,11 @@ #[test] fn grid_max_content_single_item_margin_fixed() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { margin: taffy::geometry::Rect { left: taffy::style::LengthPercentageAuto::Length(20f32), @@ -15,16 +15,11 @@ fn grid_max_content_single_item_margin_fixed() { }, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -45,9 +40,9 @@ fn grid_max_content_single_item_margin_fixed() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 150f32, "width of node {:?}. Expected {}. Actual {}", node, 150f32, size.width); diff --git a/tests/generated/grid/grid_max_content_single_item_margin_percent.rs b/tests/generated/grid/grid_max_content_single_item_margin_percent.rs index b3f7974ff..037260595 100644 --- a/tests/generated/grid/grid_max_content_single_item_margin_percent.rs +++ b/tests/generated/grid/grid_max_content_single_item_margin_percent.rs @@ -1,11 +1,11 @@ #[test] fn grid_max_content_single_item_margin_percent() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { margin: taffy::geometry::Rect { left: taffy::style::LengthPercentageAuto::Percent(0.2f32), @@ -15,16 +15,11 @@ fn grid_max_content_single_item_margin_percent() { }, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -45,9 +40,9 @@ fn grid_max_content_single_item_margin_percent() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); diff --git a/tests/generated/grid/grid_max_content_single_item_span_2.rs b/tests/generated/grid/grid_max_content_single_item_span_2.rs index 567167c29..676e299f6 100644 --- a/tests/generated/grid/grid_max_content_single_item_span_2.rs +++ b/tests/generated/grid/grid_max_content_single_item_span_2.rs @@ -1,11 +1,11 @@ #[test] fn grid_max_content_single_item_span_2() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { grid_column: taffy::geometry::Line { start: taffy::style::GridPlacement::Span(2u16), @@ -13,16 +13,11 @@ fn grid_max_content_single_item_span_2() { }, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -43,9 +38,9 @@ fn grid_max_content_single_item_span_2() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); diff --git a/tests/generated/grid/grid_max_content_single_item_span_2_gap_fixed.rs b/tests/generated/grid/grid_max_content_single_item_span_2_gap_fixed.rs index 10935c63a..1c9cb6fc7 100644 --- a/tests/generated/grid/grid_max_content_single_item_span_2_gap_fixed.rs +++ b/tests/generated/grid/grid_max_content_single_item_span_2_gap_fixed.rs @@ -1,11 +1,11 @@ #[test] fn grid_max_content_single_item_span_2_gap_fixed() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { grid_column: taffy::geometry::Line { start: taffy::style::GridPlacement::Span(2u16), @@ -13,16 +13,11 @@ fn grid_max_content_single_item_span_2_gap_fixed() { }, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -44,9 +39,9 @@ fn grid_max_content_single_item_span_2_gap_fixed() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); diff --git a/tests/generated/grid/grid_max_content_single_item_span_2_gap_percent_definite.rs b/tests/generated/grid/grid_max_content_single_item_span_2_gap_percent_definite.rs index 9603e1450..ed4a21579 100644 --- a/tests/generated/grid/grid_max_content_single_item_span_2_gap_percent_definite.rs +++ b/tests/generated/grid/grid_max_content_single_item_span_2_gap_percent_definite.rs @@ -1,11 +1,11 @@ #[test] fn grid_max_content_single_item_span_2_gap_percent_definite() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { grid_column: taffy::geometry::Line { start: taffy::style::GridPlacement::Span(2u16), @@ -13,16 +13,11 @@ fn grid_max_content_single_item_span_2_gap_percent_definite() { }, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -45,9 +40,9 @@ fn grid_max_content_single_item_span_2_gap_percent_definite() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/grid/grid_max_content_single_item_span_2_gap_percent_indefinite.rs b/tests/generated/grid/grid_max_content_single_item_span_2_gap_percent_indefinite.rs index e7befd584..ac668474e 100644 --- a/tests/generated/grid/grid_max_content_single_item_span_2_gap_percent_indefinite.rs +++ b/tests/generated/grid/grid_max_content_single_item_span_2_gap_percent_indefinite.rs @@ -1,11 +1,11 @@ #[test] fn grid_max_content_single_item_span_2_gap_percent_indefinite() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { grid_column: taffy::geometry::Line { start: taffy::style::GridPlacement::Span(2u16), @@ -13,16 +13,11 @@ fn grid_max_content_single_item_span_2_gap_percent_indefinite() { }, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -44,9 +39,9 @@ fn grid_max_content_single_item_span_2_gap_percent_indefinite() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/grid/grid_max_width_greater_than_max_content.rs b/tests/generated/grid/grid_max_width_greater_than_max_content.rs index 766e50ce6..3d4c8217a 100644 --- a/tests/generated/grid/grid_max_width_greater_than_max_content.rs +++ b/tests/generated/grid/grid_max_width_greater_than_max_content.rs @@ -1,36 +1,26 @@ #[test] fn grid_max_width_greater_than_max_content() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH\u{200b}HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH\u{200b}HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node01 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH\u{200b}HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH\u{200b}HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node0 = taffy @@ -54,9 +44,9 @@ fn grid_max_width_greater_than_max_content() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node, 160f32, size.width); diff --git a/tests/generated/grid/grid_max_width_less_than_max_content_with_min_content.rs b/tests/generated/grid/grid_max_width_less_than_max_content_with_min_content.rs index ff5388ae7..828760ab6 100644 --- a/tests/generated/grid/grid_max_width_less_than_max_content_with_min_content.rs +++ b/tests/generated/grid/grid_max_width_less_than_max_content_with_min_content.rs @@ -1,36 +1,26 @@ #[test] fn grid_max_width_less_than_max_content_with_min_content() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH\u{200b}HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH\u{200b}HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node01 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH\u{200b}HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH\u{200b}HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node0 = taffy @@ -54,9 +44,9 @@ fn grid_max_width_less_than_max_content_with_min_content() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); diff --git a/tests/generated/grid/grid_max_width_smaller_than_max_content.rs b/tests/generated/grid/grid_max_width_smaller_than_max_content.rs index 469298897..db4f3aa01 100644 --- a/tests/generated/grid/grid_max_width_smaller_than_max_content.rs +++ b/tests/generated/grid/grid_max_width_smaller_than_max_content.rs @@ -1,36 +1,26 @@ #[test] fn grid_max_width_smaller_than_max_content() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH\u{200b}HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH\u{200b}HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node01 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH\u{200b}HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH\u{200b}HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node0 = taffy @@ -54,9 +44,9 @@ fn grid_max_width_smaller_than_max_content() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); diff --git a/tests/generated/grid/grid_max_width_smaller_than_min_content.rs b/tests/generated/grid/grid_max_width_smaller_than_min_content.rs index ad1f4e10f..5de1bdc4c 100644 --- a/tests/generated/grid/grid_max_width_smaller_than_min_content.rs +++ b/tests/generated/grid/grid_max_width_smaller_than_min_content.rs @@ -1,36 +1,26 @@ #[test] fn grid_max_width_smaller_than_min_content() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HHHH\u{200b}HHHH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HHHH\u{200b}HHHH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node01 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HHHH\u{200b}HHHH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HHHH\u{200b}HHHH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node0 = taffy @@ -54,9 +44,9 @@ fn grid_max_width_smaller_than_min_content() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); diff --git a/tests/generated/grid/grid_min_content_flex_column.rs b/tests/generated/grid/grid_min_content_flex_column.rs index fd5fc2a9f..b9b36ab9b 100644 --- a/tests/generated/grid/grid_min_content_flex_column.rs +++ b/tests/generated/grid/grid_min_content_flex_column.rs @@ -1,51 +1,36 @@ #[test] fn grid_min_content_flex_column() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node01 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node02 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node0 = taffy @@ -69,9 +54,9 @@ fn grid_min_content_flex_column() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); diff --git a/tests/generated/grid/grid_min_content_flex_row.rs b/tests/generated/grid/grid_min_content_flex_row.rs index 0e6b59db2..0590790e4 100644 --- a/tests/generated/grid/grid_min_content_flex_row.rs +++ b/tests/generated/grid/grid_min_content_flex_row.rs @@ -1,51 +1,36 @@ #[test] fn grid_min_content_flex_row() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node01 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node02 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node0 = taffy @@ -65,9 +50,9 @@ fn grid_min_content_flex_row() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); diff --git a/tests/generated/grid/grid_min_content_flex_single_item.rs b/tests/generated/grid/grid_min_content_flex_single_item.rs index d0c5c30ad..f796d6f5e 100644 --- a/tests/generated/grid/grid_min_content_flex_single_item.rs +++ b/tests/generated/grid/grid_min_content_flex_single_item.rs @@ -1,8 +1,8 @@ #[test] fn grid_min_content_flex_single_item() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { @@ -13,7 +13,7 @@ fn grid_min_content_flex_single_item() { let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node4 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { grid_column: taffy::geometry::Line { start: taffy::style::GridPlacement::Span(2u16), @@ -21,16 +21,11 @@ fn grid_min_content_flex_single_item() { }, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node5 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -47,9 +42,9 @@ fn grid_min_content_flex_single_item() { &[node0, node1, node2, node3, node4, node5, node6, node7], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); diff --git a/tests/generated/grid/grid_min_content_flex_single_item_margin_auto.rs b/tests/generated/grid/grid_min_content_flex_single_item_margin_auto.rs index d0693d6da..d0acf7278 100644 --- a/tests/generated/grid/grid_min_content_flex_single_item_margin_auto.rs +++ b/tests/generated/grid/grid_min_content_flex_single_item_margin_auto.rs @@ -1,8 +1,8 @@ #[test] fn grid_min_content_flex_single_item_margin_auto() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { @@ -19,7 +19,7 @@ fn grid_min_content_flex_single_item_margin_auto() { let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node4 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { grid_column: taffy::geometry::Line { start: taffy::style::GridPlacement::Span(2u16), @@ -33,16 +33,11 @@ fn grid_min_content_flex_single_item_margin_auto() { }, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node5 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -59,9 +54,9 @@ fn grid_min_content_flex_single_item_margin_auto() { &[node0, node1, node2, node3, node4, node5, node6, node7], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); diff --git a/tests/generated/grid/grid_min_content_flex_single_item_margin_fixed.rs b/tests/generated/grid/grid_min_content_flex_single_item_margin_fixed.rs index adf6fe572..f549f0be1 100644 --- a/tests/generated/grid/grid_min_content_flex_single_item_margin_fixed.rs +++ b/tests/generated/grid/grid_min_content_flex_single_item_margin_fixed.rs @@ -1,8 +1,8 @@ #[test] fn grid_min_content_flex_single_item_margin_fixed() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { @@ -19,7 +19,7 @@ fn grid_min_content_flex_single_item_margin_fixed() { let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node4 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { grid_column: taffy::geometry::Line { start: taffy::style::GridPlacement::Span(2u16), @@ -33,16 +33,11 @@ fn grid_min_content_flex_single_item_margin_fixed() { }, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node5 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -59,9 +54,9 @@ fn grid_min_content_flex_single_item_margin_fixed() { &[node0, node1, node2, node3, node4, node5, node6, node7], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 110f32, "width of node {:?}. Expected {}. Actual {}", node, 110f32, size.width); diff --git a/tests/generated/grid/grid_min_content_flex_single_item_margin_percent.rs b/tests/generated/grid/grid_min_content_flex_single_item_margin_percent.rs index 1bae40e46..aba9f8e36 100644 --- a/tests/generated/grid/grid_min_content_flex_single_item_margin_percent.rs +++ b/tests/generated/grid/grid_min_content_flex_single_item_margin_percent.rs @@ -1,8 +1,8 @@ #[test] fn grid_min_content_flex_single_item_margin_percent() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { @@ -19,7 +19,7 @@ fn grid_min_content_flex_single_item_margin_percent() { let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node4 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { grid_column: taffy::geometry::Line { start: taffy::style::GridPlacement::Span(2u16), @@ -33,16 +33,11 @@ fn grid_min_content_flex_single_item_margin_percent() { }, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node5 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -59,9 +54,9 @@ fn grid_min_content_flex_single_item_margin_percent() { &[node0, node1, node2, node3, node4, node5, node6, node7], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); diff --git a/tests/generated/grid/grid_min_content_maximum_single_item.rs b/tests/generated/grid/grid_min_content_maximum_single_item.rs index eae8a286c..94ae8c6bc 100644 --- a/tests/generated/grid/grid_min_content_maximum_single_item.rs +++ b/tests/generated/grid/grid_min_content_maximum_single_item.rs @@ -1,22 +1,17 @@ #[test] fn grid_min_content_maximum_single_item() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -37,9 +32,9 @@ fn grid_min_content_maximum_single_item() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/grid/grid_min_content_single_item.rs b/tests/generated/grid/grid_min_content_single_item.rs index a2f1a0bec..0e0aecf29 100644 --- a/tests/generated/grid/grid_min_content_single_item.rs +++ b/tests/generated/grid/grid_min_content_single_item.rs @@ -1,22 +1,17 @@ #[test] fn grid_min_content_single_item() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -37,9 +32,9 @@ fn grid_min_content_single_item() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/grid/grid_minmax_auto_fixed_10px.rs b/tests/generated/grid/grid_minmax_auto_fixed_10px.rs index 122f17e6b..dc543ff0b 100644 --- a/tests/generated/grid/grid_minmax_auto_fixed_10px.rs +++ b/tests/generated/grid/grid_minmax_auto_fixed_10px.rs @@ -1,21 +1,16 @@ #[test] fn grid_minmax_auto_fixed_10px() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -29,9 +24,9 @@ fn grid_minmax_auto_fixed_10px() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node, 10f32, size.width); diff --git a/tests/generated/grid/grid_minmax_auto_max_content.rs b/tests/generated/grid/grid_minmax_auto_max_content.rs index bcc4b3c6f..8dce68154 100644 --- a/tests/generated/grid/grid_minmax_auto_max_content.rs +++ b/tests/generated/grid/grid_minmax_auto_max_content.rs @@ -1,21 +1,16 @@ #[test] fn grid_minmax_auto_max_content() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -29,9 +24,9 @@ fn grid_minmax_auto_max_content() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); diff --git a/tests/generated/grid/grid_minmax_auto_min_content.rs b/tests/generated/grid/grid_minmax_auto_min_content.rs index 600df4110..d6d8bd9f9 100644 --- a/tests/generated/grid/grid_minmax_auto_min_content.rs +++ b/tests/generated/grid/grid_minmax_auto_min_content.rs @@ -1,21 +1,16 @@ #[test] fn grid_minmax_auto_min_content() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -29,9 +24,9 @@ fn grid_minmax_auto_min_content() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); diff --git a/tests/generated/grid/grid_minmax_auto_percent_definite.rs b/tests/generated/grid/grid_minmax_auto_percent_definite.rs index e47d22e09..7e599cbe3 100644 --- a/tests/generated/grid/grid_minmax_auto_percent_definite.rs +++ b/tests/generated/grid/grid_minmax_auto_percent_definite.rs @@ -1,21 +1,16 @@ #[test] fn grid_minmax_auto_percent_definite() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -30,9 +25,9 @@ fn grid_minmax_auto_percent_definite() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/grid/grid_minmax_auto_percent_indefinite.rs b/tests/generated/grid/grid_minmax_auto_percent_indefinite.rs index d4d5a31f4..0db7dc230 100644 --- a/tests/generated/grid/grid_minmax_auto_percent_indefinite.rs +++ b/tests/generated/grid/grid_minmax_auto_percent_indefinite.rs @@ -1,21 +1,16 @@ #[test] fn grid_minmax_auto_percent_indefinite() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -29,9 +24,9 @@ fn grid_minmax_auto_percent_indefinite() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); diff --git a/tests/generated/grid/grid_minmax_column_fixed_width_above_range.rs b/tests/generated/grid/grid_minmax_column_fixed_width_above_range.rs index c295dcf9a..ddde11f06 100644 --- a/tests/generated/grid/grid_minmax_column_fixed_width_above_range.rs +++ b/tests/generated/grid/grid_minmax_column_fixed_width_above_range.rs @@ -1,8 +1,8 @@ #[test] fn grid_minmax_column_fixed_width_above_range() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -24,9 +24,9 @@ fn grid_minmax_column_fixed_width_above_range() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 140f32, "width of node {:?}. Expected {}. Actual {}", node, 140f32, size.width); diff --git a/tests/generated/grid/grid_minmax_column_fixed_width_below_range.rs b/tests/generated/grid/grid_minmax_column_fixed_width_below_range.rs index 063049827..973359e33 100644 --- a/tests/generated/grid/grid_minmax_column_fixed_width_below_range.rs +++ b/tests/generated/grid/grid_minmax_column_fixed_width_below_range.rs @@ -1,8 +1,8 @@ #[test] fn grid_minmax_column_fixed_width_below_range() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -24,9 +24,9 @@ fn grid_minmax_column_fixed_width_below_range() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 90f32, "width of node {:?}. Expected {}. Actual {}", node, 90f32, size.width); diff --git a/tests/generated/grid/grid_minmax_column_fixed_width_within_range.rs b/tests/generated/grid/grid_minmax_column_fixed_width_within_range.rs index 9539e18b7..45c02097c 100644 --- a/tests/generated/grid/grid_minmax_column_fixed_width_within_range.rs +++ b/tests/generated/grid/grid_minmax_column_fixed_width_within_range.rs @@ -1,8 +1,8 @@ #[test] fn grid_minmax_column_fixed_width_within_range() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -24,9 +24,9 @@ fn grid_minmax_column_fixed_width_within_range() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 110f32, "width of node {:?}. Expected {}. Actual {}", node, 110f32, size.width); diff --git a/tests/generated/grid/grid_minmax_column_indefinite.rs b/tests/generated/grid/grid_minmax_column_indefinite.rs index 5b8e516b5..99060ee5e 100644 --- a/tests/generated/grid/grid_minmax_column_indefinite.rs +++ b/tests/generated/grid/grid_minmax_column_indefinite.rs @@ -1,8 +1,8 @@ #[test] fn grid_minmax_column_indefinite() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -23,9 +23,9 @@ fn grid_minmax_column_indefinite() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); diff --git a/tests/generated/grid/grid_minmax_column_with_auto_fixed.rs b/tests/generated/grid/grid_minmax_column_with_auto_fixed.rs index f53ee3950..c60a054d8 100644 --- a/tests/generated/grid/grid_minmax_column_with_auto_fixed.rs +++ b/tests/generated/grid/grid_minmax_column_with_auto_fixed.rs @@ -1,8 +1,8 @@ #[test] fn grid_minmax_column_with_auto_fixed() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node = taffy @@ -17,9 +17,9 @@ fn grid_minmax_column_with_auto_fixed() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); diff --git a/tests/generated/grid/grid_minmax_column_with_fr_fixed.rs b/tests/generated/grid/grid_minmax_column_with_fr_fixed.rs index 5564e222a..3d6c7080a 100644 --- a/tests/generated/grid/grid_minmax_column_with_fr_fixed.rs +++ b/tests/generated/grid/grid_minmax_column_with_fr_fixed.rs @@ -1,8 +1,8 @@ #[test] fn grid_minmax_column_with_fr_fixed() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node = taffy @@ -17,9 +17,9 @@ fn grid_minmax_column_with_fr_fixed() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); diff --git a/tests/generated/grid/grid_minmax_max_content_1fr.rs b/tests/generated/grid/grid_minmax_max_content_1fr.rs index 24c4e6dc8..9b3e225a2 100644 --- a/tests/generated/grid/grid_minmax_max_content_1fr.rs +++ b/tests/generated/grid/grid_minmax_max_content_1fr.rs @@ -1,21 +1,16 @@ #[test] fn grid_minmax_max_content_1fr() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -29,9 +24,9 @@ fn grid_minmax_max_content_1fr() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); diff --git a/tests/generated/grid/grid_minmax_max_content_auto.rs b/tests/generated/grid/grid_minmax_max_content_auto.rs index f2c02bbf8..6c9672e72 100644 --- a/tests/generated/grid/grid_minmax_max_content_auto.rs +++ b/tests/generated/grid/grid_minmax_max_content_auto.rs @@ -1,21 +1,16 @@ #[test] fn grid_minmax_max_content_auto() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -29,9 +24,9 @@ fn grid_minmax_max_content_auto() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); diff --git a/tests/generated/grid/grid_minmax_max_content_fixed_10px.rs b/tests/generated/grid/grid_minmax_max_content_fixed_10px.rs index bff060443..7dc1ac65d 100644 --- a/tests/generated/grid/grid_minmax_max_content_fixed_10px.rs +++ b/tests/generated/grid/grid_minmax_max_content_fixed_10px.rs @@ -1,21 +1,16 @@ #[test] fn grid_minmax_max_content_fixed_10px() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -29,9 +24,9 @@ fn grid_minmax_max_content_fixed_10px() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); diff --git a/tests/generated/grid/grid_minmax_max_content_min_content.rs b/tests/generated/grid/grid_minmax_max_content_min_content.rs index b05825fd6..2615a9868 100644 --- a/tests/generated/grid/grid_minmax_max_content_min_content.rs +++ b/tests/generated/grid/grid_minmax_max_content_min_content.rs @@ -1,21 +1,16 @@ #[test] fn grid_minmax_max_content_min_content() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -29,9 +24,9 @@ fn grid_minmax_max_content_min_content() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); diff --git a/tests/generated/grid/grid_minmax_max_content_percent_definite.rs b/tests/generated/grid/grid_minmax_max_content_percent_definite.rs index c71b4eb07..f4fa08bab 100644 --- a/tests/generated/grid/grid_minmax_max_content_percent_definite.rs +++ b/tests/generated/grid/grid_minmax_max_content_percent_definite.rs @@ -1,21 +1,16 @@ #[test] fn grid_minmax_max_content_percent_definite() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -30,9 +25,9 @@ fn grid_minmax_max_content_percent_definite() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/grid/grid_minmax_max_content_percent_indefinite.rs b/tests/generated/grid/grid_minmax_max_content_percent_indefinite.rs index 161601c9d..89a508b42 100644 --- a/tests/generated/grid/grid_minmax_max_content_percent_indefinite.rs +++ b/tests/generated/grid/grid_minmax_max_content_percent_indefinite.rs @@ -1,21 +1,16 @@ #[test] fn grid_minmax_max_content_percent_indefinite() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -29,9 +24,9 @@ fn grid_minmax_max_content_percent_indefinite() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); diff --git a/tests/generated/grid/grid_minmax_min_content_1fr.rs b/tests/generated/grid/grid_minmax_min_content_1fr.rs index 21b94eba6..bb4a9ae37 100644 --- a/tests/generated/grid/grid_minmax_min_content_1fr.rs +++ b/tests/generated/grid/grid_minmax_min_content_1fr.rs @@ -1,21 +1,16 @@ #[test] fn grid_minmax_min_content_1fr() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -29,9 +24,9 @@ fn grid_minmax_min_content_1fr() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); diff --git a/tests/generated/grid/grid_minmax_min_content_auto.rs b/tests/generated/grid/grid_minmax_min_content_auto.rs index 989109a91..ff0a19942 100644 --- a/tests/generated/grid/grid_minmax_min_content_auto.rs +++ b/tests/generated/grid/grid_minmax_min_content_auto.rs @@ -1,21 +1,16 @@ #[test] fn grid_minmax_min_content_auto() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -29,9 +24,9 @@ fn grid_minmax_min_content_auto() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); diff --git a/tests/generated/grid/grid_minmax_min_content_fixed_10px.rs b/tests/generated/grid/grid_minmax_min_content_fixed_10px.rs index 41c37ac0d..f00717aae 100644 --- a/tests/generated/grid/grid_minmax_min_content_fixed_10px.rs +++ b/tests/generated/grid/grid_minmax_min_content_fixed_10px.rs @@ -1,21 +1,16 @@ #[test] fn grid_minmax_min_content_fixed_10px() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -29,9 +24,9 @@ fn grid_minmax_min_content_fixed_10px() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); diff --git a/tests/generated/grid/grid_minmax_min_content_max_content.rs b/tests/generated/grid/grid_minmax_min_content_max_content.rs index 4e8be75d4..54bfdb921 100644 --- a/tests/generated/grid/grid_minmax_min_content_max_content.rs +++ b/tests/generated/grid/grid_minmax_min_content_max_content.rs @@ -1,21 +1,16 @@ #[test] fn grid_minmax_min_content_max_content() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -29,9 +24,9 @@ fn grid_minmax_min_content_max_content() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); diff --git a/tests/generated/grid/grid_minmax_min_content_percent_definite.rs b/tests/generated/grid/grid_minmax_min_content_percent_definite.rs index be71cb279..45bb6f2f4 100644 --- a/tests/generated/grid/grid_minmax_min_content_percent_definite.rs +++ b/tests/generated/grid/grid_minmax_min_content_percent_definite.rs @@ -1,21 +1,16 @@ #[test] fn grid_minmax_min_content_percent_definite() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -30,9 +25,9 @@ fn grid_minmax_min_content_percent_definite() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/grid/grid_minmax_min_content_percent_indefinite.rs b/tests/generated/grid/grid_minmax_min_content_percent_indefinite.rs index bd6fa1d89..96165b4a8 100644 --- a/tests/generated/grid/grid_minmax_min_content_percent_indefinite.rs +++ b/tests/generated/grid/grid_minmax_min_content_percent_indefinite.rs @@ -1,21 +1,16 @@ #[test] fn grid_minmax_min_content_percent_indefinite() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -29,9 +24,9 @@ fn grid_minmax_min_content_percent_indefinite() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); diff --git a/tests/generated/grid/grid_out_of_order_items.rs b/tests/generated/grid/grid_out_of_order_items.rs index a95f7f863..dfc4a9a38 100644 --- a/tests/generated/grid/grid_out_of_order_items.rs +++ b/tests/generated/grid/grid_out_of_order_items.rs @@ -1,8 +1,8 @@ #[test] fn grid_out_of_order_items() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node2 = taffy @@ -56,9 +56,9 @@ fn grid_out_of_order_items() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); diff --git a/tests/generated/grid/grid_overflow_inline_axis_hidden.rs b/tests/generated/grid/grid_overflow_inline_axis_hidden.rs index 03ae544e8..2155d2f78 100644 --- a/tests/generated/grid/grid_overflow_inline_axis_hidden.rs +++ b/tests/generated/grid/grid_overflow_inline_axis_hidden.rs @@ -1,10 +1,10 @@ #[test] fn grid_overflow_inline_axis_hidden() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { overflow: taffy::geometry::Point { x: taffy::style::Overflow::Hidden, @@ -13,16 +13,11 @@ fn grid_overflow_inline_axis_hidden() { scrollbar_width: 15f32, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HHHHHHHHHH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HHHHHHHHHH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -38,9 +33,9 @@ fn grid_overflow_inline_axis_hidden() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/grid/grid_overflow_inline_axis_scroll.rs b/tests/generated/grid/grid_overflow_inline_axis_scroll.rs index d62578613..4b3d4e221 100644 --- a/tests/generated/grid/grid_overflow_inline_axis_scroll.rs +++ b/tests/generated/grid/grid_overflow_inline_axis_scroll.rs @@ -1,10 +1,10 @@ #[test] fn grid_overflow_inline_axis_scroll() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { overflow: taffy::geometry::Point { x: taffy::style::Overflow::Scroll, @@ -13,16 +13,11 @@ fn grid_overflow_inline_axis_scroll() { scrollbar_width: 15f32, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HHHHHHHHHH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HHHHHHHHHH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -38,9 +33,9 @@ fn grid_overflow_inline_axis_scroll() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/grid/grid_overflow_inline_axis_visible.rs b/tests/generated/grid/grid_overflow_inline_axis_visible.rs index af556dfc0..f604a0d49 100644 --- a/tests/generated/grid/grid_overflow_inline_axis_visible.rs +++ b/tests/generated/grid/grid_overflow_inline_axis_visible.rs @@ -1,21 +1,16 @@ #[test] fn grid_overflow_inline_axis_visible() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HHHHHHHHHH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HHHHHHHHHH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -31,9 +26,9 @@ fn grid_overflow_inline_axis_visible() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/grid/grid_overflow_rows.rs b/tests/generated/grid/grid_overflow_rows.rs index d77be3aff..393dcc624 100644 --- a/tests/generated/grid/grid_overflow_rows.rs +++ b/tests/generated/grid/grid_overflow_rows.rs @@ -1,24 +1,19 @@ #[test] fn grid_overflow_rows() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { grid_column: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Span(4u16) }, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -37,9 +32,9 @@ fn grid_overflow_rows() { &[node0, node1, node2, node3, node4, node5], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); diff --git a/tests/generated/grid/grid_overflow_scrollbars_overriden_by_available_space.rs b/tests/generated/grid/grid_overflow_scrollbars_overriden_by_available_space.rs index d163bd960..133c29da0 100644 --- a/tests/generated/grid/grid_overflow_scrollbars_overriden_by_available_space.rs +++ b/tests/generated/grid/grid_overflow_scrollbars_overriden_by_available_space.rs @@ -1,8 +1,8 @@ #[test] fn grid_overflow_scrollbars_overriden_by_available_space() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node0 = taffy .new_with_children( @@ -31,9 +31,9 @@ fn grid_overflow_scrollbars_overriden_by_available_space() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node, 2f32, size.width); diff --git a/tests/generated/grid/grid_overflow_scrollbars_overriden_by_max_size.rs b/tests/generated/grid/grid_overflow_scrollbars_overriden_by_max_size.rs index 11911947b..9fa87112e 100644 --- a/tests/generated/grid/grid_overflow_scrollbars_overriden_by_max_size.rs +++ b/tests/generated/grid/grid_overflow_scrollbars_overriden_by_max_size.rs @@ -1,8 +1,8 @@ #[test] fn grid_overflow_scrollbars_overriden_by_max_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node = taffy .new_with_children( @@ -22,9 +22,9 @@ fn grid_overflow_scrollbars_overriden_by_max_size() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node, 2f32, size.width); diff --git a/tests/generated/grid/grid_overflow_scrollbars_overriden_by_size.rs b/tests/generated/grid/grid_overflow_scrollbars_overriden_by_size.rs index 46368c9a7..c62e41c05 100644 --- a/tests/generated/grid/grid_overflow_scrollbars_overriden_by_size.rs +++ b/tests/generated/grid/grid_overflow_scrollbars_overriden_by_size.rs @@ -1,8 +1,8 @@ #[test] fn grid_overflow_scrollbars_overriden_by_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node = taffy .new_with_children( @@ -22,9 +22,9 @@ fn grid_overflow_scrollbars_overriden_by_size() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node, 2f32, size.width); diff --git a/tests/generated/grid/grid_overflow_scrollbars_take_up_space_both_axis.rs b/tests/generated/grid/grid_overflow_scrollbars_take_up_space_both_axis.rs index a87ea6cdf..2b0d3670d 100644 --- a/tests/generated/grid/grid_overflow_scrollbars_take_up_space_both_axis.rs +++ b/tests/generated/grid/grid_overflow_scrollbars_take_up_space_both_axis.rs @@ -1,8 +1,8 @@ #[test] fn grid_overflow_scrollbars_take_up_space_both_axis() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node = taffy .new_with_children( @@ -22,9 +22,9 @@ fn grid_overflow_scrollbars_take_up_space_both_axis() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/grid/grid_overflow_scrollbars_take_up_space_x_axis.rs b/tests/generated/grid/grid_overflow_scrollbars_take_up_space_x_axis.rs index 2dc411f90..82245a207 100644 --- a/tests/generated/grid/grid_overflow_scrollbars_take_up_space_x_axis.rs +++ b/tests/generated/grid/grid_overflow_scrollbars_take_up_space_x_axis.rs @@ -1,8 +1,8 @@ #[test] fn grid_overflow_scrollbars_take_up_space_x_axis() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node = taffy .new_with_children( @@ -22,9 +22,9 @@ fn grid_overflow_scrollbars_take_up_space_x_axis() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/grid/grid_overflow_scrollbars_take_up_space_y_axis.rs b/tests/generated/grid/grid_overflow_scrollbars_take_up_space_y_axis.rs index 085b8534d..a6eab02a7 100644 --- a/tests/generated/grid/grid_overflow_scrollbars_take_up_space_y_axis.rs +++ b/tests/generated/grid/grid_overflow_scrollbars_take_up_space_y_axis.rs @@ -1,8 +1,8 @@ #[test] fn grid_overflow_scrollbars_take_up_space_y_axis() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node = taffy .new_with_children( @@ -22,9 +22,9 @@ fn grid_overflow_scrollbars_take_up_space_y_axis() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/grid/grid_padding_border_overrides_container_max_size.rs b/tests/generated/grid/grid_padding_border_overrides_container_max_size.rs index 120669afa..0030d5a4b 100644 --- a/tests/generated/grid/grid_padding_border_overrides_container_max_size.rs +++ b/tests/generated/grid/grid_padding_border_overrides_container_max_size.rs @@ -1,8 +1,8 @@ #[test] fn grid_padding_border_overrides_container_max_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node = taffy .new_with_children( @@ -29,9 +29,9 @@ fn grid_padding_border_overrides_container_max_size() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node, 22f32, size.width); diff --git a/tests/generated/grid/grid_padding_border_overrides_container_size.rs b/tests/generated/grid/grid_padding_border_overrides_container_size.rs index c17647204..824263ad6 100644 --- a/tests/generated/grid/grid_padding_border_overrides_container_size.rs +++ b/tests/generated/grid/grid_padding_border_overrides_container_size.rs @@ -1,8 +1,8 @@ #[test] fn grid_padding_border_overrides_container_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node = taffy .new_with_children( @@ -29,9 +29,9 @@ fn grid_padding_border_overrides_container_size() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node, 22f32, size.width); diff --git a/tests/generated/grid/grid_padding_border_overrides_max_size.rs b/tests/generated/grid/grid_padding_border_overrides_max_size.rs index df6a4a772..c86e7a59f 100644 --- a/tests/generated/grid/grid_padding_border_overrides_max_size.rs +++ b/tests/generated/grid/grid_padding_border_overrides_max_size.rs @@ -1,8 +1,8 @@ #[test] fn grid_padding_border_overrides_max_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { max_size: taffy::geometry::Size { @@ -27,9 +27,9 @@ fn grid_padding_border_overrides_max_size() { let node = taffy .new_with_children(taffy::style::Style { display: taffy::style::Display::Grid, ..Default::default() }, &[node0]) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node, 22f32, size.width); diff --git a/tests/generated/grid/grid_padding_border_overrides_min_size.rs b/tests/generated/grid/grid_padding_border_overrides_min_size.rs index 5e3d75471..2f802ea9b 100644 --- a/tests/generated/grid/grid_padding_border_overrides_min_size.rs +++ b/tests/generated/grid/grid_padding_border_overrides_min_size.rs @@ -1,8 +1,8 @@ #[test] fn grid_padding_border_overrides_min_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { min_size: taffy::geometry::Size { @@ -27,9 +27,9 @@ fn grid_padding_border_overrides_min_size() { let node = taffy .new_with_children(taffy::style::Style { display: taffy::style::Display::Grid, ..Default::default() }, &[node0]) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node, 22f32, size.width); diff --git a/tests/generated/grid/grid_padding_border_overrides_size.rs b/tests/generated/grid/grid_padding_border_overrides_size.rs index 380ecf3b8..b893ac5f6 100644 --- a/tests/generated/grid/grid_padding_border_overrides_size.rs +++ b/tests/generated/grid/grid_padding_border_overrides_size.rs @@ -1,8 +1,8 @@ #[test] fn grid_padding_border_overrides_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -27,9 +27,9 @@ fn grid_padding_border_overrides_size() { let node = taffy .new_with_children(taffy::style::Style { display: taffy::style::Display::Grid, ..Default::default() }, &[node0]) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node, 22f32, size.width); diff --git a/tests/generated/grid/grid_percent_item_inside_stretch_item.rs b/tests/generated/grid/grid_percent_item_inside_stretch_item.rs index 3c76b4356..8b8f04c32 100644 --- a/tests/generated/grid/grid_percent_item_inside_stretch_item.rs +++ b/tests/generated/grid/grid_percent_item_inside_stretch_item.rs @@ -1,8 +1,8 @@ #[test] fn grid_percent_item_inside_stretch_item() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, @@ -29,9 +29,9 @@ fn grid_percent_item_inside_stretch_item() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/grid/grid_percent_items_nested_inside_stretch_alignment.rs b/tests/generated/grid/grid_percent_items_nested_inside_stretch_alignment.rs index 12a720c01..9363d0c92 100644 --- a/tests/generated/grid/grid_percent_items_nested_inside_stretch_alignment.rs +++ b/tests/generated/grid/grid_percent_items_nested_inside_stretch_alignment.rs @@ -1,8 +1,8 @@ #[test] fn grid_percent_items_nested_inside_stretch_alignment() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, @@ -31,9 +31,9 @@ fn grid_percent_items_nested_inside_stretch_alignment() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/grid/grid_percent_items_nested_moderate.rs b/tests/generated/grid/grid_percent_items_nested_moderate.rs index aa8a12d03..a16247754 100644 --- a/tests/generated/grid/grid_percent_items_nested_moderate.rs +++ b/tests/generated/grid/grid_percent_items_nested_moderate.rs @@ -1,8 +1,8 @@ #[test] fn grid_percent_items_nested_moderate() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); taffy.disable_rounding(); let node00 = taffy .new_leaf(taffy::style::Style { @@ -60,9 +60,9 @@ fn grid_percent_items_nested_moderate() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert!(size.width - 200f32 < 0.1, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/grid/grid_percent_items_nested_with_margin.rs b/tests/generated/grid/grid_percent_items_nested_with_margin.rs index 99358e50a..abfe10186 100644 --- a/tests/generated/grid/grid_percent_items_nested_with_margin.rs +++ b/tests/generated/grid/grid_percent_items_nested_with_margin.rs @@ -1,8 +1,8 @@ #[test] fn grid_percent_items_nested_with_margin() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Percent(0.45f32), height: auto() }, @@ -35,9 +35,9 @@ fn grid_percent_items_nested_with_margin() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/grid/grid_percent_items_nested_with_padding_margin.rs b/tests/generated/grid/grid_percent_items_nested_with_padding_margin.rs index 2f671d62d..f28e13b3e 100644 --- a/tests/generated/grid/grid_percent_items_nested_with_padding_margin.rs +++ b/tests/generated/grid/grid_percent_items_nested_with_padding_margin.rs @@ -1,8 +1,8 @@ #[test] fn grid_percent_items_nested_with_padding_margin() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node000 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Percent(0.45f32), height: auto() }, @@ -80,9 +80,9 @@ fn grid_percent_items_nested_with_padding_margin() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/grid/grid_percent_items_width_and_margin.rs b/tests/generated/grid/grid_percent_items_width_and_margin.rs index e092f8325..6723327d4 100644 --- a/tests/generated/grid/grid_percent_items_width_and_margin.rs +++ b/tests/generated/grid/grid_percent_items_width_and_margin.rs @@ -1,8 +1,8 @@ #[test] fn grid_percent_items_width_and_margin() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Percent(0.45f32), height: auto() }, @@ -37,9 +37,9 @@ fn grid_percent_items_width_and_margin() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/grid/grid_percent_items_width_and_padding.rs b/tests/generated/grid/grid_percent_items_width_and_padding.rs index 01304ffc2..1233bd921 100644 --- a/tests/generated/grid/grid_percent_items_width_and_padding.rs +++ b/tests/generated/grid/grid_percent_items_width_and_padding.rs @@ -1,8 +1,8 @@ #[test] fn grid_percent_items_width_and_padding() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Percent(0.5f32), height: auto() }, @@ -25,9 +25,9 @@ fn grid_percent_items_width_and_padding() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); diff --git a/tests/generated/grid/grid_percent_tracks_definite_overflow.rs b/tests/generated/grid/grid_percent_tracks_definite_overflow.rs index 6d2b1ce31..e8bdcba09 100644 --- a/tests/generated/grid/grid_percent_tracks_definite_overflow.rs +++ b/tests/generated/grid/grid_percent_tracks_definite_overflow.rs @@ -1,8 +1,8 @@ #[test] fn grid_percent_tracks_definite_overflow() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -24,9 +24,9 @@ fn grid_percent_tracks_definite_overflow() { &[node0, node1, node2, node3, node4, node5], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); diff --git a/tests/generated/grid/grid_percent_tracks_definite_underflow.rs b/tests/generated/grid/grid_percent_tracks_definite_underflow.rs index 12bd7212e..94f6e0a45 100644 --- a/tests/generated/grid/grid_percent_tracks_definite_underflow.rs +++ b/tests/generated/grid/grid_percent_tracks_definite_underflow.rs @@ -1,8 +1,8 @@ #[test] fn grid_percent_tracks_definite_underflow() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -24,9 +24,9 @@ fn grid_percent_tracks_definite_underflow() { &[node0, node1, node2, node3, node4, node5], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); diff --git a/tests/generated/grid/grid_percent_tracks_indefinite_only.rs b/tests/generated/grid/grid_percent_tracks_indefinite_only.rs index 27114c4ba..c6f6d83cf 100644 --- a/tests/generated/grid/grid_percent_tracks_indefinite_only.rs +++ b/tests/generated/grid/grid_percent_tracks_indefinite_only.rs @@ -1,8 +1,8 @@ #[test] fn grid_percent_tracks_indefinite_only() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -20,9 +20,9 @@ fn grid_percent_tracks_indefinite_only() { &[node0, node1, node2, node3, node4, node5], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); diff --git a/tests/generated/grid/grid_percent_tracks_indefinite_with_content_overflow.rs b/tests/generated/grid/grid_percent_tracks_indefinite_with_content_overflow.rs index a29b97a67..eb84cce85 100644 --- a/tests/generated/grid/grid_percent_tracks_indefinite_with_content_overflow.rs +++ b/tests/generated/grid/grid_percent_tracks_indefinite_with_content_overflow.rs @@ -1,8 +1,8 @@ #[test] fn grid_percent_tracks_indefinite_with_content_overflow() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, @@ -37,9 +37,9 @@ fn grid_percent_tracks_indefinite_with_content_overflow() { &[node0, node1, node2, node3, node4, node5, node6], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/grid/grid_percent_tracks_indefinite_with_content_underflow.rs b/tests/generated/grid/grid_percent_tracks_indefinite_with_content_underflow.rs index 646fb7e5b..0db3e3d11 100644 --- a/tests/generated/grid/grid_percent_tracks_indefinite_with_content_underflow.rs +++ b/tests/generated/grid/grid_percent_tracks_indefinite_with_content_underflow.rs @@ -1,8 +1,8 @@ #[test] fn grid_percent_tracks_indefinite_with_content_underflow() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, @@ -37,9 +37,9 @@ fn grid_percent_tracks_indefinite_with_content_underflow() { &[node0, node1, node2, node3, node4, node5, node6], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/grid/grid_placement_auto_negative.rs b/tests/generated/grid/grid_placement_auto_negative.rs index c734172a4..0d50c278d 100644 --- a/tests/generated/grid/grid_placement_auto_negative.rs +++ b/tests/generated/grid/grid_placement_auto_negative.rs @@ -1,8 +1,8 @@ #[test] fn grid_placement_auto_negative() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, @@ -32,9 +32,9 @@ fn grid_placement_auto_negative() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); diff --git a/tests/generated/grid/grid_placement_definite_in_secondary_axis_with_fully_definite_negative.rs b/tests/generated/grid/grid_placement_definite_in_secondary_axis_with_fully_definite_negative.rs index 7ab2cd096..a7c6e1ad4 100644 --- a/tests/generated/grid/grid_placement_definite_in_secondary_axis_with_fully_definite_negative.rs +++ b/tests/generated/grid/grid_placement_definite_in_secondary_axis_with_fully_definite_negative.rs @@ -1,8 +1,8 @@ #[test] fn grid_placement_definite_in_secondary_axis_with_fully_definite_negative() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { grid_row: taffy::geometry::Line { start: line(2i16), end: taffy::style::GridPlacement::Auto }, @@ -37,9 +37,9 @@ fn grid_placement_definite_in_secondary_axis_with_fully_definite_negative() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); diff --git a/tests/generated/grid/grid_relative_all_sides.rs b/tests/generated/grid/grid_relative_all_sides.rs index e980f92db..ef5716ee6 100644 --- a/tests/generated/grid/grid_relative_all_sides.rs +++ b/tests/generated/grid/grid_relative_all_sides.rs @@ -1,8 +1,8 @@ #[test] fn grid_relative_all_sides() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Length(40f32), height: auto() }, @@ -28,9 +28,9 @@ fn grid_relative_all_sides() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/grid/grid_relayout_vertical_text.rs b/tests/generated/grid/grid_relayout_vertical_text.rs index ce398c9d8..0d6736b15 100644 --- a/tests/generated/grid/grid_relayout_vertical_text.rs +++ b/tests/generated/grid/grid_relayout_vertical_text.rs @@ -1,36 +1,26 @@ #[test] fn grid_relayout_vertical_text() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Vertical, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH", + writing_mode: crate::WritingMode::Vertical, + _aspect_ratio: None, + }, ) .unwrap(); let node1 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -44,9 +34,9 @@ fn grid_relayout_vertical_text() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); diff --git a/tests/generated/grid/grid_repeat_integer.rs b/tests/generated/grid/grid_repeat_integer.rs index 5f8341875..31acc02bf 100644 --- a/tests/generated/grid/grid_repeat_integer.rs +++ b/tests/generated/grid/grid_repeat_integer.rs @@ -1,8 +1,8 @@ #[test] fn grid_repeat_integer() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -27,9 +27,9 @@ fn grid_repeat_integer() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); diff --git a/tests/generated/grid/grid_repeat_mixed.rs b/tests/generated/grid/grid_repeat_mixed.rs index 38da44ce6..7b4114974 100644 --- a/tests/generated/grid/grid_repeat_mixed.rs +++ b/tests/generated/grid/grid_repeat_mixed.rs @@ -1,8 +1,8 @@ #[test] fn grid_repeat_mixed() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -35,9 +35,9 @@ fn grid_repeat_mixed() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); diff --git a/tests/generated/grid/grid_size_child_fixed_tracks.rs b/tests/generated/grid/grid_size_child_fixed_tracks.rs index 5c8103c58..e9527a4a5 100644 --- a/tests/generated/grid/grid_size_child_fixed_tracks.rs +++ b/tests/generated/grid/grid_size_child_fixed_tracks.rs @@ -1,103 +1,78 @@ #[test] fn grid_size_child_fixed_tracks() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { align_self: Some(taffy::style::AlignSelf::Start), justify_self: Some(taffy::style::JustifySelf::Start), ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH\u{200b}HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH\u{200b}HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node1 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { align_self: Some(taffy::style::AlignSelf::Start), justify_self: Some(taffy::style::JustifySelf::Start), ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HHH\u{200b}HHH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HHH\u{200b}HHH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node2 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { align_self: Some(taffy::style::AlignSelf::Start), justify_self: Some(taffy::style::JustifySelf::Start), ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HHHH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HHHH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node3 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { align_self: Some(taffy::style::AlignSelf::Start), justify_self: Some(taffy::style::JustifySelf::Start), size: taffy::geometry::Size { width: taffy::style::Dimension::Length(20f32), height: auto() }, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH\u{200b}HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH\u{200b}HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node4 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { align_self: Some(taffy::style::AlignSelf::Start), justify_self: Some(taffy::style::JustifySelf::Start), max_size: taffy::geometry::Size { width: taffy::style::Dimension::Length(30f32), height: auto() }, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH\u{200b}HH\u{200b}HH\u{200b}HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH\u{200b}HH\u{200b}HH\u{200b}HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -115,9 +90,9 @@ fn grid_size_child_fixed_tracks() { &[node0, node1, node2, node3, node4], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); diff --git a/tests/generated/grid/grid_span_13_most_non_flex_with_minmax_indefinite.rs b/tests/generated/grid/grid_span_13_most_non_flex_with_minmax_indefinite.rs index 433a19d8b..ac2a59ec9 100644 --- a/tests/generated/grid/grid_span_13_most_non_flex_with_minmax_indefinite.rs +++ b/tests/generated/grid/grid_span_13_most_non_flex_with_minmax_indefinite.rs @@ -1,24 +1,19 @@ #[test] fn grid_span_13_most_non_flex_with_minmax_indefinite() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { grid_column: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Span(13u16) }, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -59,9 +54,9 @@ fn grid_span_13_most_non_flex_with_minmax_indefinite() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8, node9, node10, node11, node12, node13], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 322f32, "width of node {:?}. Expected {}. Actual {}", node, 322f32, size.width); diff --git a/tests/generated/grid/grid_span_13_most_non_flex_with_minmax_indefinite_hidden.rs b/tests/generated/grid/grid_span_13_most_non_flex_with_minmax_indefinite_hidden.rs index 0dc03ab34..c410f5003 100644 --- a/tests/generated/grid/grid_span_13_most_non_flex_with_minmax_indefinite_hidden.rs +++ b/tests/generated/grid/grid_span_13_most_non_flex_with_minmax_indefinite_hidden.rs @@ -1,10 +1,10 @@ #[test] fn grid_span_13_most_non_flex_with_minmax_indefinite_hidden() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { overflow: taffy::geometry::Point { x: taffy::style::Overflow::Hidden, @@ -14,16 +14,11 @@ fn grid_span_13_most_non_flex_with_minmax_indefinite_hidden() { grid_column: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Span(13u16) }, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -64,9 +59,9 @@ fn grid_span_13_most_non_flex_with_minmax_indefinite_hidden() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8, node9, node10, node11, node12, node13], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 322f32, "width of node {:?}. Expected {}. Actual {}", node, 322f32, size.width); diff --git a/tests/generated/grid/grid_span_2_max_content_auto_indefinite.rs b/tests/generated/grid/grid_span_2_max_content_auto_indefinite.rs index d37918ad2..626d41a78 100644 --- a/tests/generated/grid/grid_span_2_max_content_auto_indefinite.rs +++ b/tests/generated/grid/grid_span_2_max_content_auto_indefinite.rs @@ -1,8 +1,8 @@ #[test] fn grid_span_2_max_content_auto_indefinite() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, @@ -18,22 +18,17 @@ fn grid_span_2_max_content_auto_indefinite() { }) .unwrap(); let node2 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, grid_column: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Span(2u16) }, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HHHH\u{200b}HHHH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HHHH\u{200b}HHHH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -47,9 +42,9 @@ fn grid_span_2_max_content_auto_indefinite() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); diff --git a/tests/generated/grid/grid_span_2_max_content_auto_indefinite_hidden.rs b/tests/generated/grid/grid_span_2_max_content_auto_indefinite_hidden.rs index 069c4f44e..2960ca353 100644 --- a/tests/generated/grid/grid_span_2_max_content_auto_indefinite_hidden.rs +++ b/tests/generated/grid/grid_span_2_max_content_auto_indefinite_hidden.rs @@ -1,8 +1,8 @@ #[test] fn grid_span_2_max_content_auto_indefinite_hidden() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, @@ -28,9 +28,9 @@ fn grid_span_2_max_content_auto_indefinite_hidden() { &[node0, node1], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); diff --git a/tests/generated/grid/grid_span_2_max_content_fit_content_10px_indefinite.rs b/tests/generated/grid/grid_span_2_max_content_fit_content_10px_indefinite.rs index 221de6295..a1e43570a 100644 --- a/tests/generated/grid/grid_span_2_max_content_fit_content_10px_indefinite.rs +++ b/tests/generated/grid/grid_span_2_max_content_fit_content_10px_indefinite.rs @@ -1,8 +1,8 @@ #[test] fn grid_span_2_max_content_fit_content_10px_indefinite() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, @@ -18,22 +18,17 @@ fn grid_span_2_max_content_fit_content_10px_indefinite() { }) .unwrap(); let node2 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, grid_column: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Span(2u16) }, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HHHH\u{200b}HHHH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HHHH\u{200b}HHHH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -47,9 +42,9 @@ fn grid_span_2_max_content_fit_content_10px_indefinite() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); diff --git a/tests/generated/grid/grid_span_2_max_content_fit_content_10px_indefinite_hidden.rs b/tests/generated/grid/grid_span_2_max_content_fit_content_10px_indefinite_hidden.rs index 4c739478a..b41c053d3 100644 --- a/tests/generated/grid/grid_span_2_max_content_fit_content_10px_indefinite_hidden.rs +++ b/tests/generated/grid/grid_span_2_max_content_fit_content_10px_indefinite_hidden.rs @@ -1,8 +1,8 @@ #[test] fn grid_span_2_max_content_fit_content_10px_indefinite_hidden() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, @@ -18,7 +18,7 @@ fn grid_span_2_max_content_fit_content_10px_indefinite_hidden() { }) .unwrap(); let node2 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { overflow: taffy::geometry::Point { x: taffy::style::Overflow::Hidden, @@ -29,16 +29,11 @@ fn grid_span_2_max_content_fit_content_10px_indefinite_hidden() { grid_column: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Span(2u16) }, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HHHH\u{200b}HHHH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HHHH\u{200b}HHHH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -52,9 +47,9 @@ fn grid_span_2_max_content_fit_content_10px_indefinite_hidden() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); diff --git a/tests/generated/grid/grid_span_2_max_content_fit_content_80px_indefinite.rs b/tests/generated/grid/grid_span_2_max_content_fit_content_80px_indefinite.rs index 158f9db91..1c60b39f3 100644 --- a/tests/generated/grid/grid_span_2_max_content_fit_content_80px_indefinite.rs +++ b/tests/generated/grid/grid_span_2_max_content_fit_content_80px_indefinite.rs @@ -1,8 +1,8 @@ #[test] fn grid_span_2_max_content_fit_content_80px_indefinite() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, @@ -18,22 +18,17 @@ fn grid_span_2_max_content_fit_content_80px_indefinite() { }) .unwrap(); let node2 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, grid_column: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Span(2u16) }, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HHHH\u{200b}HHHH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HHHH\u{200b}HHHH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -47,9 +42,9 @@ fn grid_span_2_max_content_fit_content_80px_indefinite() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); diff --git a/tests/generated/grid/grid_span_2_max_content_fit_content_80px_indefinite_hidden.rs b/tests/generated/grid/grid_span_2_max_content_fit_content_80px_indefinite_hidden.rs index 45a5656c8..0d0b57025 100644 --- a/tests/generated/grid/grid_span_2_max_content_fit_content_80px_indefinite_hidden.rs +++ b/tests/generated/grid/grid_span_2_max_content_fit_content_80px_indefinite_hidden.rs @@ -1,8 +1,8 @@ #[test] fn grid_span_2_max_content_fit_content_80px_indefinite_hidden() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, @@ -18,7 +18,7 @@ fn grid_span_2_max_content_fit_content_80px_indefinite_hidden() { }) .unwrap(); let node2 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { overflow: taffy::geometry::Point { x: taffy::style::Overflow::Hidden, @@ -29,16 +29,11 @@ fn grid_span_2_max_content_fit_content_80px_indefinite_hidden() { grid_column: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Span(2u16) }, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HHHH\u{200b}HHHH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HHHH\u{200b}HHHH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -52,9 +47,9 @@ fn grid_span_2_max_content_fit_content_80px_indefinite_hidden() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); diff --git a/tests/generated/grid/grid_span_2_max_content_max_content_indefinite.rs b/tests/generated/grid/grid_span_2_max_content_max_content_indefinite.rs index 77bbbdf6e..ad7c9f64e 100644 --- a/tests/generated/grid/grid_span_2_max_content_max_content_indefinite.rs +++ b/tests/generated/grid/grid_span_2_max_content_max_content_indefinite.rs @@ -1,8 +1,8 @@ #[test] fn grid_span_2_max_content_max_content_indefinite() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, @@ -18,22 +18,17 @@ fn grid_span_2_max_content_max_content_indefinite() { }) .unwrap(); let node2 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, grid_column: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Span(2u16) }, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HHHH\u{200b}HHHH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HHHH\u{200b}HHHH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -47,9 +42,9 @@ fn grid_span_2_max_content_max_content_indefinite() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); diff --git a/tests/generated/grid/grid_span_2_min_content_auto_indefinite.rs b/tests/generated/grid/grid_span_2_min_content_auto_indefinite.rs index 3e12bd2f2..0b4ef169d 100644 --- a/tests/generated/grid/grid_span_2_min_content_auto_indefinite.rs +++ b/tests/generated/grid/grid_span_2_min_content_auto_indefinite.rs @@ -1,26 +1,21 @@ #[test] fn grid_span_2_min_content_auto_indefinite() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node2 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { grid_column: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Span(2u16) }, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HHHH\u{200b}HHHH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HHHH\u{200b}HHHH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -34,9 +29,9 @@ fn grid_span_2_min_content_auto_indefinite() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); diff --git a/tests/generated/grid/grid_span_2_min_content_auto_indefinite_hidden.rs b/tests/generated/grid/grid_span_2_min_content_auto_indefinite_hidden.rs index c04d1d0ae..af75d3aa6 100644 --- a/tests/generated/grid/grid_span_2_min_content_auto_indefinite_hidden.rs +++ b/tests/generated/grid/grid_span_2_min_content_auto_indefinite_hidden.rs @@ -1,12 +1,12 @@ #[test] fn grid_span_2_min_content_auto_indefinite_hidden() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); let node2 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { overflow: taffy::geometry::Point { x: taffy::style::Overflow::Hidden, @@ -16,16 +16,11 @@ fn grid_span_2_min_content_auto_indefinite_hidden() { grid_column: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Span(2u16) }, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HHHH\u{200b}HHHH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HHHH\u{200b}HHHH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -39,9 +34,9 @@ fn grid_span_2_min_content_auto_indefinite_hidden() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); diff --git a/tests/generated/grid/grid_span_2_min_content_fit_content_10px_indefinite.rs b/tests/generated/grid/grid_span_2_min_content_fit_content_10px_indefinite.rs index 0513b9487..a0780dc97 100644 --- a/tests/generated/grid/grid_span_2_min_content_fit_content_10px_indefinite.rs +++ b/tests/generated/grid/grid_span_2_min_content_fit_content_10px_indefinite.rs @@ -1,8 +1,8 @@ #[test] fn grid_span_2_min_content_fit_content_10px_indefinite() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, @@ -18,22 +18,17 @@ fn grid_span_2_min_content_fit_content_10px_indefinite() { }) .unwrap(); let node2 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, grid_column: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Span(2u16) }, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HHHH\u{200b}HHHH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HHHH\u{200b}HHHH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -47,9 +42,9 @@ fn grid_span_2_min_content_fit_content_10px_indefinite() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); diff --git a/tests/generated/grid/grid_span_2_min_content_fit_content_10px_indefinite_hidden.rs b/tests/generated/grid/grid_span_2_min_content_fit_content_10px_indefinite_hidden.rs index c83692f56..d60143868 100644 --- a/tests/generated/grid/grid_span_2_min_content_fit_content_10px_indefinite_hidden.rs +++ b/tests/generated/grid/grid_span_2_min_content_fit_content_10px_indefinite_hidden.rs @@ -1,8 +1,8 @@ #[test] fn grid_span_2_min_content_fit_content_10px_indefinite_hidden() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, @@ -18,7 +18,7 @@ fn grid_span_2_min_content_fit_content_10px_indefinite_hidden() { }) .unwrap(); let node2 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { overflow: taffy::geometry::Point { x: taffy::style::Overflow::Hidden, @@ -29,16 +29,11 @@ fn grid_span_2_min_content_fit_content_10px_indefinite_hidden() { grid_column: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Span(2u16) }, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HHHH\u{200b}HHHH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HHHH\u{200b}HHHH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -52,9 +47,9 @@ fn grid_span_2_min_content_fit_content_10px_indefinite_hidden() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/grid/grid_span_2_min_content_fit_content_30px_indefinite.rs b/tests/generated/grid/grid_span_2_min_content_fit_content_30px_indefinite.rs index 5a98bc509..c369c1584 100644 --- a/tests/generated/grid/grid_span_2_min_content_fit_content_30px_indefinite.rs +++ b/tests/generated/grid/grid_span_2_min_content_fit_content_30px_indefinite.rs @@ -1,8 +1,8 @@ #[test] fn grid_span_2_min_content_fit_content_30px_indefinite() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, @@ -18,22 +18,17 @@ fn grid_span_2_min_content_fit_content_30px_indefinite() { }) .unwrap(); let node2 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, grid_column: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Span(2u16) }, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HHHH\u{200b}HHHH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HHHH\u{200b}HHHH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -47,9 +42,9 @@ fn grid_span_2_min_content_fit_content_30px_indefinite() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/grid/grid_span_2_min_content_fit_content_30px_indefinite_hidden.rs b/tests/generated/grid/grid_span_2_min_content_fit_content_30px_indefinite_hidden.rs index cbc67914b..823454be5 100644 --- a/tests/generated/grid/grid_span_2_min_content_fit_content_30px_indefinite_hidden.rs +++ b/tests/generated/grid/grid_span_2_min_content_fit_content_30px_indefinite_hidden.rs @@ -1,8 +1,8 @@ #[test] fn grid_span_2_min_content_fit_content_30px_indefinite_hidden() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, @@ -18,7 +18,7 @@ fn grid_span_2_min_content_fit_content_30px_indefinite_hidden() { }) .unwrap(); let node2 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { overflow: taffy::geometry::Point { x: taffy::style::Overflow::Hidden, @@ -29,16 +29,11 @@ fn grid_span_2_min_content_fit_content_30px_indefinite_hidden() { grid_column: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Span(2u16) }, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HHHH\u{200b}HHHH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HHHH\u{200b}HHHH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -52,9 +47,9 @@ fn grid_span_2_min_content_fit_content_30px_indefinite_hidden() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node, 70f32, size.width); diff --git a/tests/generated/grid/grid_span_2_min_content_fit_content_80px_indefinite.rs b/tests/generated/grid/grid_span_2_min_content_fit_content_80px_indefinite.rs index f30f26071..08d9d8eea 100644 --- a/tests/generated/grid/grid_span_2_min_content_fit_content_80px_indefinite.rs +++ b/tests/generated/grid/grid_span_2_min_content_fit_content_80px_indefinite.rs @@ -1,8 +1,8 @@ #[test] fn grid_span_2_min_content_fit_content_80px_indefinite() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, @@ -18,22 +18,17 @@ fn grid_span_2_min_content_fit_content_80px_indefinite() { }) .unwrap(); let node2 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, grid_column: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Span(2u16) }, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HHHH\u{200b}HHHH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HHHH\u{200b}HHHH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -47,9 +42,9 @@ fn grid_span_2_min_content_fit_content_80px_indefinite() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); diff --git a/tests/generated/grid/grid_span_2_min_content_fit_content_80px_indefinite_hidden.rs b/tests/generated/grid/grid_span_2_min_content_fit_content_80px_indefinite_hidden.rs index ac574eebc..24a9681a1 100644 --- a/tests/generated/grid/grid_span_2_min_content_fit_content_80px_indefinite_hidden.rs +++ b/tests/generated/grid/grid_span_2_min_content_fit_content_80px_indefinite_hidden.rs @@ -1,8 +1,8 @@ #[test] fn grid_span_2_min_content_fit_content_80px_indefinite_hidden() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, @@ -18,7 +18,7 @@ fn grid_span_2_min_content_fit_content_80px_indefinite_hidden() { }) .unwrap(); let node2 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { overflow: taffy::geometry::Point { x: taffy::style::Overflow::Hidden, @@ -29,16 +29,11 @@ fn grid_span_2_min_content_fit_content_80px_indefinite_hidden() { grid_column: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Span(2u16) }, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HHHH\u{200b}HHHH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HHHH\u{200b}HHHH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -52,9 +47,9 @@ fn grid_span_2_min_content_fit_content_80px_indefinite_hidden() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); diff --git a/tests/generated/grid/grid_span_2_min_content_max_content_indefinite.rs b/tests/generated/grid/grid_span_2_min_content_max_content_indefinite.rs index 137c49795..27da30dc2 100644 --- a/tests/generated/grid/grid_span_2_min_content_max_content_indefinite.rs +++ b/tests/generated/grid/grid_span_2_min_content_max_content_indefinite.rs @@ -1,8 +1,8 @@ #[test] fn grid_span_2_min_content_max_content_indefinite() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, @@ -18,22 +18,17 @@ fn grid_span_2_min_content_max_content_indefinite() { }) .unwrap(); let node2 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, grid_column: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Span(2u16) }, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HHHH\u{200b}HHHH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HHHH\u{200b}HHHH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -47,9 +42,9 @@ fn grid_span_2_min_content_max_content_indefinite() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); diff --git a/tests/generated/grid/grid_span_2_min_content_min_content_indefinite.rs b/tests/generated/grid/grid_span_2_min_content_min_content_indefinite.rs index 45ec76c86..86ff399e4 100644 --- a/tests/generated/grid/grid_span_2_min_content_min_content_indefinite.rs +++ b/tests/generated/grid/grid_span_2_min_content_min_content_indefinite.rs @@ -1,8 +1,8 @@ #[test] fn grid_span_2_min_content_min_content_indefinite() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, @@ -18,22 +18,17 @@ fn grid_span_2_min_content_min_content_indefinite() { }) .unwrap(); let node2 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, grid_column: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Span(2u16) }, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HHHH\u{200b}HHHH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HHHH\u{200b}HHHH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node = taffy @@ -47,9 +42,9 @@ fn grid_span_2_min_content_min_content_indefinite() { &[node0, node1, node2], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); diff --git a/tests/generated/grid/grid_span_6_all_non_flex_indefinite.rs b/tests/generated/grid/grid_span_6_all_non_flex_indefinite.rs index 6040b4d3f..6a69c7998 100644 --- a/tests/generated/grid/grid_span_6_all_non_flex_indefinite.rs +++ b/tests/generated/grid/grid_span_6_all_non_flex_indefinite.rs @@ -1,24 +1,19 @@ #[test] fn grid_span_6_all_non_flex_indefinite() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { grid_column: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Span(6u16) }, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HHHHHHHH\u{200b}HHHHHHHH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HHHHHHHH\u{200b}HHHHHHHH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -45,9 +40,9 @@ fn grid_span_6_all_non_flex_indefinite() { &[node0, node1, node2, node3, node4, node5, node6], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node, 160f32, size.width); diff --git a/tests/generated/grid/grid_span_6_all_non_flex_indefinite_hidden.rs b/tests/generated/grid/grid_span_6_all_non_flex_indefinite_hidden.rs index ae8a298d3..9c6861d37 100644 --- a/tests/generated/grid/grid_span_6_all_non_flex_indefinite_hidden.rs +++ b/tests/generated/grid/grid_span_6_all_non_flex_indefinite_hidden.rs @@ -1,10 +1,10 @@ #[test] fn grid_span_6_all_non_flex_indefinite_hidden() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { overflow: taffy::geometry::Point { x: taffy::style::Overflow::Hidden, @@ -14,16 +14,11 @@ fn grid_span_6_all_non_flex_indefinite_hidden() { grid_column: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Span(6u16) }, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HHHHHHHH\u{200b}HHHHHHHH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HHHHHHHH\u{200b}HHHHHHHH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -50,9 +45,9 @@ fn grid_span_6_all_non_flex_indefinite_hidden() { &[node0, node1, node2, node3, node4, node5, node6], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node, 160f32, size.width); diff --git a/tests/generated/grid/grid_span_8_all_track_types_indefinite.rs b/tests/generated/grid/grid_span_8_all_track_types_indefinite.rs index 1097ff3f8..b38f3c664 100644 --- a/tests/generated/grid/grid_span_8_all_track_types_indefinite.rs +++ b/tests/generated/grid/grid_span_8_all_track_types_indefinite.rs @@ -1,24 +1,19 @@ #[test] fn grid_span_8_all_track_types_indefinite() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { grid_column: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Span(8u16) }, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HHHHHHHH\u{200b}HHHHHHHH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HHHHHHHH\u{200b}HHHHHHHH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); @@ -49,9 +44,9 @@ fn grid_span_8_all_track_types_indefinite() { &[node0, node1, node2, node3, node4, node5, node6, node7, node8], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node, 160f32, size.width); diff --git a/tests/generated/gridflex/gridflex_column_integration.rs b/tests/generated/gridflex/gridflex_column_integration.rs index 0f2672a60..be0f022bf 100644 --- a/tests/generated/gridflex/gridflex_column_integration.rs +++ b/tests/generated/gridflex/gridflex_column_integration.rs @@ -1,66 +1,46 @@ #[test] fn gridflex_column_integration() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node01 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node02 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node03 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node0 = taffy @@ -80,9 +60,9 @@ fn gridflex_column_integration() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); diff --git a/tests/generated/gridflex/gridflex_kitchen_sink.rs b/tests/generated/gridflex/gridflex_kitchen_sink.rs index 16da7ab8e..ed0bd959d 100644 --- a/tests/generated/gridflex/gridflex_kitchen_sink.rs +++ b/tests/generated/gridflex/gridflex_kitchen_sink.rs @@ -1,8 +1,8 @@ #[test] fn gridflex_kitchen_sink() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node000 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Length(20f32), height: auto() }, @@ -41,48 +41,33 @@ fn gridflex_kitchen_sink() { .unwrap(); let node00 = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node000, node001]).unwrap(); let node01 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node02 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node03 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node0 = taffy @@ -97,9 +82,9 @@ fn gridflex_kitchen_sink() { ) .unwrap(); let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0]).unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 140f32, "width of node {:?}. Expected {}. Actual {}", node, 140f32, size.width); diff --git a/tests/generated/gridflex/gridflex_kitchen_sink_minimise.rs b/tests/generated/gridflex/gridflex_kitchen_sink_minimise.rs index 8ab89ee32..9cfc835dc 100644 --- a/tests/generated/gridflex/gridflex_kitchen_sink_minimise.rs +++ b/tests/generated/gridflex/gridflex_kitchen_sink_minimise.rs @@ -1,8 +1,8 @@ #[test] fn gridflex_kitchen_sink_minimise() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: taffy::style::Dimension::Length(50f32), height: auto() }, @@ -22,9 +22,9 @@ fn gridflex_kitchen_sink_minimise() { ) .unwrap(); let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0]).unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); diff --git a/tests/generated/gridflex/gridflex_kitchen_sink_minimise2.rs b/tests/generated/gridflex/gridflex_kitchen_sink_minimise2.rs index 81825ef61..7bdf995f3 100644 --- a/tests/generated/gridflex/gridflex_kitchen_sink_minimise2.rs +++ b/tests/generated/gridflex/gridflex_kitchen_sink_minimise2.rs @@ -1,8 +1,8 @@ #[test] fn gridflex_kitchen_sink_minimise2() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -33,9 +33,9 @@ fn gridflex_kitchen_sink_minimise2() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/gridflex/gridflex_kitchen_sink_minimise3.rs b/tests/generated/gridflex/gridflex_kitchen_sink_minimise3.rs index b6bd5ab37..c18accc9a 100644 --- a/tests/generated/gridflex/gridflex_kitchen_sink_minimise3.rs +++ b/tests/generated/gridflex/gridflex_kitchen_sink_minimise3.rs @@ -1,8 +1,8 @@ #[test] fn gridflex_kitchen_sink_minimise3() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -35,9 +35,9 @@ fn gridflex_kitchen_sink_minimise3() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); diff --git a/tests/generated/gridflex/gridflex_row_integration.rs b/tests/generated/gridflex/gridflex_row_integration.rs index 61576b4b5..8d51d272c 100644 --- a/tests/generated/gridflex/gridflex_row_integration.rs +++ b/tests/generated/gridflex/gridflex_row_integration.rs @@ -1,66 +1,46 @@ #[test] fn gridflex_row_integration() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node00 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node01 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node02 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node03 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); let node0 = taffy @@ -75,9 +55,9 @@ fn gridflex_row_integration() { ) .unwrap(); let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0]).unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); diff --git a/tests/generated/leaf/leaf_overflow_scrollbars_affect_available_space_x_axis.rs b/tests/generated/leaf/leaf_overflow_scrollbars_affect_available_space_x_axis.rs index e17296c10..0b983aabe 100644 --- a/tests/generated/leaf/leaf_overflow_scrollbars_affect_available_space_x_axis.rs +++ b/tests/generated/leaf/leaf_overflow_scrollbars_affect_available_space_x_axis.rs @@ -1,10 +1,10 @@ #[test] fn leaf_overflow_scrollbars_affect_available_space_x_axis() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { overflow: taffy::geometry::Point { x: taffy::style::Overflow::Scroll, @@ -17,21 +17,16 @@ fn leaf_overflow_scrollbars_affect_available_space_x_axis() { }, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "H\u{a0}H\u{a0}H\u{a0}H\u{a0}H\u{a0}H\u{a0}H\u{a0}H\u{a0}H\u{a0}H\u{a0}H"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "H\u{a0}H\u{a0}H\u{a0}H\u{a0}H\u{a0}H\u{a0}H\u{a0}H\u{a0}H\u{a0}H\u{a0}H", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 45f32, "width of node {:?}. Expected {}. Actual {}", node, 45f32, size.width); diff --git a/tests/generated/leaf/leaf_overflow_scrollbars_affect_available_space_y_axis.rs b/tests/generated/leaf/leaf_overflow_scrollbars_affect_available_space_y_axis.rs index e41a36448..e893f08d3 100644 --- a/tests/generated/leaf/leaf_overflow_scrollbars_affect_available_space_y_axis.rs +++ b/tests/generated/leaf/leaf_overflow_scrollbars_affect_available_space_y_axis.rs @@ -1,10 +1,10 @@ #[test] fn leaf_overflow_scrollbars_affect_available_space_y_axis() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, @@ -17,21 +17,16 @@ fn leaf_overflow_scrollbars_affect_available_space_y_axis() { }, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "H\u{a0}H\u{a0}H\u{a0}H\u{a0}H\u{a0}H\u{a0}H\u{a0}H\u{a0}H\u{a0}H\u{a0}H"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "H\u{a0}H\u{a0}H\u{a0}H\u{a0}H\u{a0}H\u{a0}H\u{a0}H\u{a0}H\u{a0}H\u{a0}H", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 45f32, "width of node {:?}. Expected {}. Actual {}", node, 45f32, size.width); diff --git a/tests/generated/leaf/leaf_overflow_scrollbars_overriden_by_available_space.rs b/tests/generated/leaf/leaf_overflow_scrollbars_overriden_by_available_space.rs index 123e1e780..9e0e3928b 100644 --- a/tests/generated/leaf/leaf_overflow_scrollbars_overriden_by_available_space.rs +++ b/tests/generated/leaf/leaf_overflow_scrollbars_overriden_by_available_space.rs @@ -1,8 +1,8 @@ #[test] fn leaf_overflow_scrollbars_overriden_by_available_space() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node0 = taffy .new_leaf(taffy::style::Style { overflow: taffy::geometry::Point { x: taffy::style::Overflow::Scroll, y: taffy::style::Overflow::Scroll }, @@ -23,9 +23,9 @@ fn leaf_overflow_scrollbars_overriden_by_available_space() { &[node0], ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node, 2f32, size.width); diff --git a/tests/generated/leaf/leaf_overflow_scrollbars_overriden_by_max_size.rs b/tests/generated/leaf/leaf_overflow_scrollbars_overriden_by_max_size.rs index 68d8db518..3c1640625 100644 --- a/tests/generated/leaf/leaf_overflow_scrollbars_overriden_by_max_size.rs +++ b/tests/generated/leaf/leaf_overflow_scrollbars_overriden_by_max_size.rs @@ -1,8 +1,8 @@ #[test] fn leaf_overflow_scrollbars_overriden_by_max_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node = taffy .new_leaf(taffy::style::Style { overflow: taffy::geometry::Point { x: taffy::style::Overflow::Scroll, y: taffy::style::Overflow::Scroll }, @@ -14,9 +14,9 @@ fn leaf_overflow_scrollbars_overriden_by_max_size() { ..Default::default() }) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node, 2f32, size.width); diff --git a/tests/generated/leaf/leaf_overflow_scrollbars_overriden_by_size.rs b/tests/generated/leaf/leaf_overflow_scrollbars_overriden_by_size.rs index 383a0ea0c..18b138199 100644 --- a/tests/generated/leaf/leaf_overflow_scrollbars_overriden_by_size.rs +++ b/tests/generated/leaf/leaf_overflow_scrollbars_overriden_by_size.rs @@ -1,8 +1,8 @@ #[test] fn leaf_overflow_scrollbars_overriden_by_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node = taffy .new_leaf(taffy::style::Style { overflow: taffy::geometry::Point { x: taffy::style::Overflow::Scroll, y: taffy::style::Overflow::Scroll }, @@ -14,9 +14,9 @@ fn leaf_overflow_scrollbars_overriden_by_size() { ..Default::default() }) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node, 2f32, size.width); diff --git a/tests/generated/leaf/leaf_overflow_scrollbars_take_up_space_both_axis.rs b/tests/generated/leaf/leaf_overflow_scrollbars_take_up_space_both_axis.rs index b24d97364..0237bd0a2 100644 --- a/tests/generated/leaf/leaf_overflow_scrollbars_take_up_space_both_axis.rs +++ b/tests/generated/leaf/leaf_overflow_scrollbars_take_up_space_both_axis.rs @@ -1,10 +1,10 @@ #[test] fn leaf_overflow_scrollbars_take_up_space_both_axis() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { overflow: taffy::geometry::Point { x: taffy::style::Overflow::Scroll, @@ -13,21 +13,16 @@ fn leaf_overflow_scrollbars_take_up_space_both_axis() { scrollbar_width: 15f32, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 35f32, "width of node {:?}. Expected {}. Actual {}", node, 35f32, size.width); diff --git a/tests/generated/leaf/leaf_overflow_scrollbars_take_up_space_x_axis.rs b/tests/generated/leaf/leaf_overflow_scrollbars_take_up_space_x_axis.rs index b97aade4e..6c0135593 100644 --- a/tests/generated/leaf/leaf_overflow_scrollbars_take_up_space_x_axis.rs +++ b/tests/generated/leaf/leaf_overflow_scrollbars_take_up_space_x_axis.rs @@ -1,10 +1,10 @@ #[test] fn leaf_overflow_scrollbars_take_up_space_x_axis() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { overflow: taffy::geometry::Point { x: taffy::style::Overflow::Scroll, @@ -13,21 +13,16 @@ fn leaf_overflow_scrollbars_take_up_space_x_axis() { scrollbar_width: 15f32, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); diff --git a/tests/generated/leaf/leaf_overflow_scrollbars_take_up_space_y_axis.rs b/tests/generated/leaf/leaf_overflow_scrollbars_take_up_space_y_axis.rs index f7adf543f..44e580a68 100644 --- a/tests/generated/leaf/leaf_overflow_scrollbars_take_up_space_y_axis.rs +++ b/tests/generated/leaf/leaf_overflow_scrollbars_take_up_space_y_axis.rs @@ -1,10 +1,10 @@ #[test] fn leaf_overflow_scrollbars_take_up_space_y_axis() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, @@ -13,21 +13,16 @@ fn leaf_overflow_scrollbars_take_up_space_y_axis() { scrollbar_width: 15f32, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 35f32, "width of node {:?}. Expected {}. Actual {}", node, 35f32, size.width); diff --git a/tests/generated/leaf/leaf_padding_border_overrides_max_size.rs b/tests/generated/leaf/leaf_padding_border_overrides_max_size.rs index 6cd76533d..69d0bbb2d 100644 --- a/tests/generated/leaf/leaf_padding_border_overrides_max_size.rs +++ b/tests/generated/leaf/leaf_padding_border_overrides_max_size.rs @@ -1,8 +1,8 @@ #[test] fn leaf_padding_border_overrides_max_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node = taffy .new_leaf(taffy::style::Style { max_size: taffy::geometry::Size { @@ -24,9 +24,9 @@ fn leaf_padding_border_overrides_max_size() { ..Default::default() }) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node, 22f32, size.width); diff --git a/tests/generated/leaf/leaf_padding_border_overrides_min_size.rs b/tests/generated/leaf/leaf_padding_border_overrides_min_size.rs index af01e10ec..409fbc8cd 100644 --- a/tests/generated/leaf/leaf_padding_border_overrides_min_size.rs +++ b/tests/generated/leaf/leaf_padding_border_overrides_min_size.rs @@ -1,8 +1,8 @@ #[test] fn leaf_padding_border_overrides_min_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node = taffy .new_leaf(taffy::style::Style { min_size: taffy::geometry::Size { @@ -24,9 +24,9 @@ fn leaf_padding_border_overrides_min_size() { ..Default::default() }) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node, 22f32, size.width); diff --git a/tests/generated/leaf/leaf_padding_border_overrides_size.rs b/tests/generated/leaf/leaf_padding_border_overrides_size.rs index 480615037..bb77e5c2e 100644 --- a/tests/generated/leaf/leaf_padding_border_overrides_size.rs +++ b/tests/generated/leaf/leaf_padding_border_overrides_size.rs @@ -1,8 +1,8 @@ #[test] fn leaf_padding_border_overrides_size() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -24,9 +24,9 @@ fn leaf_padding_border_overrides_size() { ..Default::default() }) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node, 22f32, size.width); diff --git a/tests/generated/leaf/leaf_with_content_and_border.rs b/tests/generated/leaf/leaf_with_content_and_border.rs index af47c13a0..09f247f0d 100644 --- a/tests/generated/leaf/leaf_with_content_and_border.rs +++ b/tests/generated/leaf/leaf_with_content_and_border.rs @@ -1,10 +1,10 @@ #[test] fn leaf_with_content_and_border() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { border: taffy::geometry::Rect { left: taffy::style::LengthPercentage::Length(8f32), @@ -14,21 +14,16 @@ fn leaf_with_content_and_border() { }, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HHHH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HHHH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 52f32, "width of node {:?}. Expected {}. Actual {}", node, 52f32, size.width); diff --git a/tests/generated/leaf/leaf_with_content_and_padding.rs b/tests/generated/leaf/leaf_with_content_and_padding.rs index 8cae6c5cd..f54d17c2b 100644 --- a/tests/generated/leaf/leaf_with_content_and_padding.rs +++ b/tests/generated/leaf/leaf_with_content_and_padding.rs @@ -1,10 +1,10 @@ #[test] fn leaf_with_content_and_padding() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { padding: taffy::geometry::Rect { left: taffy::style::LengthPercentage::Length(8f32), @@ -14,21 +14,16 @@ fn leaf_with_content_and_padding() { }, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HHHH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HHHH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 52f32, "width of node {:?}. Expected {}. Actual {}", node, 52f32, size.width); diff --git a/tests/generated/leaf/leaf_with_content_and_padding_border.rs b/tests/generated/leaf/leaf_with_content_and_padding_border.rs index 17a2cf52c..08c647936 100644 --- a/tests/generated/leaf/leaf_with_content_and_padding_border.rs +++ b/tests/generated/leaf/leaf_with_content_and_padding_border.rs @@ -1,10 +1,10 @@ #[test] fn leaf_with_content_and_padding_border() { #[allow(unused_imports)] - use taffy::{prelude::*, tree::Layout}; - let mut taffy = taffy::Taffy::new(); + use taffy::{prelude::*, tree::Layout, Taffy}; + let mut taffy: Taffy = Taffy::new(); let node = taffy - .new_leaf_with_measure( + .new_leaf_with_context( taffy::style::Style { padding: taffy::geometry::Rect { left: taffy::style::LengthPercentage::Length(8f32), @@ -20,21 +20,16 @@ fn leaf_with_content_and_padding_border() { }, ..Default::default() }, - taffy::tree::MeasureFunc::Raw(|known_dimensions, available_space| { - const TEXT: &str = "HHHH"; - crate::measure_standard_text( - known_dimensions, - available_space, - TEXT, - crate::WritingMode::Horizontal, - None, - ) - }), + crate::TextMeasure { + text_content: "HHHH", + writing_mode: crate::WritingMode::Horizontal, + _aspect_ratio: None, + }, ) .unwrap(); - taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); - taffy::util::print_tree(&taffy, node); + taffy.print_tree(node); println!(); let Layout { size, location, .. } = taffy.layout(node).unwrap(); assert_eq!(size.width, 62f32, "width of node {:?}. Expected {}. Actual {}", node, 62f32, size.width); diff --git a/tests/measure.rs b/tests/measure.rs index 5948387d0..3c5bf4236 100644 --- a/tests/measure.rs +++ b/tests/measure.rs @@ -1,22 +1,46 @@ #[cfg(test)] mod measure { use taffy::prelude::*; - use taffy::tree::MeasureFunc; + + #[derive(Debug, Clone, Copy)] + struct FixedMeasure { + width: f32, + height: f32, + } + fn fixed_measure_function( + known_dimensions: Size>, + _available_space: Size, + _node_id: NodeId, + node_context: Option<&mut FixedMeasure>, + ) -> taffy::geometry::Size { + let size = node_context.copied().unwrap_or(FixedMeasure { width: 0.0, height: 0.0 }); + Size { + width: known_dimensions.width.unwrap_or(size.width), + height: known_dimensions.height.unwrap_or(size.height), + } + } + + struct AspectRatioMeasure { + width: f32, + height_ratio: f32, + } + fn aspect_ratio_measure_function( + known_dimensions: Size>, + _available_space: Size, + _node_id: NodeId, + node_context: Option<&mut AspectRatioMeasure>, + ) -> taffy::geometry::Size { + let node_context = node_context.unwrap(); + let width = known_dimensions.width.unwrap_or(node_context.width); + let height = known_dimensions.height.unwrap_or(width * node_context.height_ratio); + Size { width, height } + } #[test] fn measure_root() { - let mut taffy = Taffy::new(); - let node = taffy - .new_leaf_with_measure( - Style::default(), - MeasureFunc::Raw(|known_dimensions, _available_space| Size { - width: known_dimensions.width.unwrap_or(100.0), - height: known_dimensions.height.unwrap_or(100.0), - }), - ) - .unwrap(); - - taffy.compute_layout(node, Size::MAX_CONTENT).unwrap(); + let mut taffy: Taffy = Taffy::new(); + let node = taffy.new_leaf_with_context(Style::default(), FixedMeasure { width: 100.0, height: 100.0 }).unwrap(); + taffy.compute_layout_with_measure(node, Size::MAX_CONTENT, fixed_measure_function).unwrap(); assert_eq!(taffy.layout(node).unwrap().size.width, 100.0); assert_eq!(taffy.layout(node).unwrap().size.height, 100.0); @@ -24,20 +48,13 @@ mod measure { #[test] fn measure_child() { - let mut taffy = Taffy::new(); + let mut taffy: Taffy = Taffy::new(); - let child = taffy - .new_leaf_with_measure( - Style::default(), - MeasureFunc::Raw(|known_dimensions, _available_space| Size { - width: known_dimensions.width.unwrap_or(100.0), - height: known_dimensions.height.unwrap_or(100.0), - }), - ) - .unwrap(); + let child = + taffy.new_leaf_with_context(Style::default(), FixedMeasure { width: 100.0, height: 100.0 }).unwrap(); let node = taffy.new_with_children(Style::default(), &[child]).unwrap(); - taffy.compute_layout(node, Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, Size::MAX_CONTENT, fixed_measure_function).unwrap(); assert_eq!(taffy.layout(node).unwrap().size.width, 100.0); assert_eq!(taffy.layout(node).unwrap().size.height, 100.0); @@ -48,16 +65,9 @@ mod measure { #[test] fn measure_child_constraint() { - let mut taffy = Taffy::new(); - let child = taffy - .new_leaf_with_measure( - Style::default(), - MeasureFunc::Raw(|known_dimensions, _available_space| Size { - width: known_dimensions.width.unwrap_or(100.0), - height: known_dimensions.height.unwrap_or(100.0), - }), - ) - .unwrap(); + let mut taffy: Taffy = Taffy::new(); + let child = + taffy.new_leaf_with_context(Style::default(), FixedMeasure { width: 100.0, height: 100.0 }).unwrap(); let node = taffy .new_with_children( @@ -66,7 +76,7 @@ mod measure { ) .unwrap(); - taffy.compute_layout(node, Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, Size::MAX_CONTENT, fixed_measure_function).unwrap(); // Parent assert_eq!(taffy.layout(node).unwrap().size.width, 50.0); @@ -78,16 +88,9 @@ mod measure { #[test] fn measure_child_constraint_padding_parent() { - let mut taffy = Taffy::new(); - let child = taffy - .new_leaf_with_measure( - Style::default(), - MeasureFunc::Raw(|known_dimensions, _available_space| Size { - width: known_dimensions.width.unwrap_or(100.0), - height: known_dimensions.height.unwrap_or(100.0), - }), - ) - .unwrap(); + let mut taffy: Taffy = Taffy::new(); + let child = + taffy.new_leaf_with_context(Style::default(), FixedMeasure { width: 100.0, height: 100.0 }).unwrap(); let node = taffy .new_with_children( @@ -104,7 +107,7 @@ mod measure { &[child], ) .unwrap(); - taffy.compute_layout(node, Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, Size::MAX_CONTENT, fixed_measure_function).unwrap(); assert_eq!(taffy.layout(node).unwrap().location.x, 0.0); assert_eq!(taffy.layout(node).unwrap().location.y, 0.0); @@ -119,7 +122,7 @@ mod measure { #[test] fn measure_child_with_flex_grow() { - let mut taffy = Taffy::new(); + let mut taffy: Taffy = Taffy::new(); let child0 = taffy .new_leaf(Style { size: Size { width: Dimension::Length(50.0), height: Dimension::Length(50.0) }, @@ -128,12 +131,9 @@ mod measure { .unwrap(); let child1 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( Style { flex_grow: 1.0, ..Default::default() }, - MeasureFunc::Raw(|known_dimensions, _available_space| Size { - width: known_dimensions.width.unwrap_or(10.0), - height: known_dimensions.height.unwrap_or(50.0), - }), + FixedMeasure { width: 10.0, height: 50.0 }, ) .unwrap(); @@ -144,7 +144,7 @@ mod measure { ) .unwrap(); - taffy.compute_layout(node, Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, Size::MAX_CONTENT, fixed_measure_function).unwrap(); assert_eq!(taffy.layout(child1).unwrap().size.width, 50.0); assert_eq!(taffy.layout(child1).unwrap().size.height, 50.0); @@ -152,7 +152,7 @@ mod measure { #[test] fn measure_child_with_flex_shrink() { - let mut taffy = Taffy::new(); + let mut taffy: Taffy = Taffy::new(); let child0 = taffy .new_leaf(Style { size: Size { width: Dimension::Length(50.0), height: Dimension::Length(50.0) }, @@ -161,15 +161,8 @@ mod measure { }) .unwrap(); - let child1 = taffy - .new_leaf_with_measure( - Style::default(), - MeasureFunc::Raw(|known_dimensions, _available_space| Size { - width: known_dimensions.width.unwrap_or(100.0), - height: known_dimensions.height.unwrap_or(50.0), - }), - ) - .unwrap(); + let child1 = + taffy.new_leaf_with_context(Style::default(), FixedMeasure { width: 100.0, height: 50.0 }).unwrap(); let node = taffy .new_with_children( @@ -178,7 +171,7 @@ mod measure { ) .unwrap(); - taffy.compute_layout(node, Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, Size::MAX_CONTENT, fixed_measure_function).unwrap(); assert_eq!(taffy.layout(child1).unwrap().size.width, 100.0); assert_eq!(taffy.layout(child1).unwrap().size.height, 50.0); @@ -186,7 +179,7 @@ mod measure { #[test] fn remeasure_child_after_growing() { - let mut taffy = Taffy::new(); + let mut taffy: Taffy = Taffy::new(); let child0 = taffy .new_leaf(Style { size: Size { width: Dimension::Length(50.0), height: Dimension::Length(50.0) }, @@ -195,13 +188,9 @@ mod measure { .unwrap(); let child1 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( Style { flex_grow: 1.0, ..Default::default() }, - MeasureFunc::Raw(|known_dimensions, _available_space| { - let width = known_dimensions.width.unwrap_or(10.0); - let height = known_dimensions.height.unwrap_or(width * 2.0); - Size { width, height } - }), + AspectRatioMeasure { width: 10.0, height_ratio: 2.0 }, ) .unwrap(); @@ -216,7 +205,7 @@ mod measure { ) .unwrap(); - taffy.compute_layout(node, Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, Size::MAX_CONTENT, aspect_ratio_measure_function).unwrap(); assert_eq!(taffy.layout(child1).unwrap().size.width, 50.0); assert_eq!(taffy.layout(child1).unwrap().size.height, 100.0); @@ -224,7 +213,7 @@ mod measure { #[test] fn remeasure_child_after_shrinking() { - let mut taffy = Taffy::new(); + let mut taffy: Taffy = Taffy::new(); let child0 = taffy .new_leaf(Style { @@ -235,14 +224,7 @@ mod measure { .unwrap(); let child1 = taffy - .new_leaf_with_measure( - Style::default(), - MeasureFunc::Raw(|known_dimensions, _available_space| { - let width = known_dimensions.width.unwrap_or(100.0); - let height = known_dimensions.height.unwrap_or(width * 2.0); - Size { width, height } - }), - ) + .new_leaf_with_context(Style::default(), AspectRatioMeasure { width: 100.0, height_ratio: 2.0 }) .unwrap(); let node = taffy @@ -256,7 +238,7 @@ mod measure { ) .unwrap(); - taffy.compute_layout(node, Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, Size::MAX_CONTENT, aspect_ratio_measure_function).unwrap(); assert_eq!(taffy.layout(child1).unwrap().size.width, 100.0); assert_eq!(taffy.layout(child1).unwrap().size.height, 200.0); @@ -264,18 +246,20 @@ mod measure { #[test] fn remeasure_child_after_stretching() { - let mut taffy = Taffy::new(); + let mut taffy: Taffy<()> = Taffy::new(); - let child = taffy - .new_leaf_with_measure( - Style::default(), - MeasureFunc::Raw(|known_dimensions, _available_space| { - let height = known_dimensions.height.unwrap_or(50.0); - let width = known_dimensions.width.unwrap_or(height); - Size { width, height } - }), - ) - .unwrap(); + fn custom_measure_function( + known_dimensions: Size>, + _available_space: Size, + _node_id: NodeId, + _node_context: Option<&mut ()>, + ) -> taffy::geometry::Size { + let height = known_dimensions.height.unwrap_or(50.0); + let width = known_dimensions.width.unwrap_or(height); + Size { width, height } + } + + let child = taffy.new_leaf_with_context(Style::default(), ()).unwrap(); let node = taffy .new_with_children( @@ -287,7 +271,7 @@ mod measure { ) .unwrap(); - taffy.compute_layout(node, Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, Size::MAX_CONTENT, custom_measure_function).unwrap(); assert_eq!(taffy.layout(child).unwrap().size.width, 100.0); assert_eq!(taffy.layout(child).unwrap().size.height, 100.0); @@ -295,19 +279,16 @@ mod measure { #[test] fn width_overrides_measure() { - let mut taffy = Taffy::new(); + let mut taffy: Taffy = Taffy::new(); let child = taffy - .new_leaf_with_measure( + .new_leaf_with_context( Style { size: Size { width: Dimension::Length(50.0), height: auto() }, ..Default::default() }, - MeasureFunc::Raw(|known_dimensions, _available_space| Size { - width: known_dimensions.width.unwrap_or(100.0), - height: known_dimensions.height.unwrap_or(100.0), - }), + FixedMeasure { width: 100.0, height: 100.0 }, ) .unwrap(); let node = taffy.new_with_children(Style::default(), &[child]).unwrap(); - taffy.compute_layout(node, Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, Size::MAX_CONTENT, fixed_measure_function).unwrap(); assert_eq!(taffy.layout(child).unwrap().size.width, 50.0); assert_eq!(taffy.layout(child).unwrap().size.height, 100.0); @@ -315,19 +296,16 @@ mod measure { #[test] fn height_overrides_measure() { - let mut taffy = Taffy::new(); + let mut taffy: Taffy = Taffy::new(); let child = taffy - .new_leaf_with_measure( + .new_leaf_with_context( Style { size: Size { width: auto(), height: Dimension::Length(50.0) }, ..Default::default() }, - MeasureFunc::Raw(|known_dimensions, _available_space| Size { - width: known_dimensions.width.unwrap_or(100.0), - height: known_dimensions.height.unwrap_or(100.0), - }), + FixedMeasure { width: 100.0, height: 100.0 }, ) .unwrap(); let node = taffy.new_with_children(Style::default(), &[child]).unwrap(); - taffy.compute_layout(node, Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, Size::MAX_CONTENT, fixed_measure_function).unwrap(); assert_eq!(taffy.layout(child).unwrap().size.width, 100.0); assert_eq!(taffy.layout(child).unwrap().size.height, 50.0); @@ -335,18 +313,15 @@ mod measure { #[test] fn flex_basis_overrides_measure() { - let mut taffy = Taffy::new(); + let mut taffy: Taffy = Taffy::new(); let child0 = taffy .new_leaf(Style { flex_basis: Dimension::Length(50.0), flex_grow: 1.0, ..Default::default() }) .unwrap(); let child1 = taffy - .new_leaf_with_measure( + .new_leaf_with_context( Style { flex_basis: Dimension::Length(50.0), flex_grow: 1.0, ..Default::default() }, - MeasureFunc::Raw(|known_dimensions, _available_space| Size { - width: known_dimensions.width.unwrap_or(100.0), - height: known_dimensions.height.unwrap_or(100.0), - }), + FixedMeasure { width: 100.0, height: 100.0 }, ) .unwrap(); @@ -360,7 +335,7 @@ mod measure { ) .unwrap(); - taffy.compute_layout(node, Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, Size::MAX_CONTENT, fixed_measure_function).unwrap(); assert_eq!(taffy.layout(child0).unwrap().size.width, 100.0); assert_eq!(taffy.layout(child0).unwrap().size.height, 100.0); @@ -370,16 +345,8 @@ mod measure { #[test] fn stretch_overrides_measure() { - let mut taffy = Taffy::new(); - let child = taffy - .new_leaf_with_measure( - Style::default(), - MeasureFunc::Raw(|known_dimensions, _available_space| Size { - width: known_dimensions.width.unwrap_or(50.0), - height: known_dimensions.height.unwrap_or(50.0), - }), - ) - .unwrap(); + let mut taffy: Taffy = Taffy::new(); + let child = taffy.new_leaf_with_context(Style::default(), FixedMeasure { width: 50.0, height: 50.0 }).unwrap(); let node = taffy .new_with_children( @@ -391,7 +358,7 @@ mod measure { ) .unwrap(); - taffy.compute_layout(node, Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, Size::MAX_CONTENT, fixed_measure_function).unwrap(); assert_eq!(taffy.layout(child).unwrap().size.width, 50.0); assert_eq!(taffy.layout(child).unwrap().size.height, 100.0); @@ -399,14 +366,11 @@ mod measure { #[test] fn measure_absolute_child() { - let mut taffy = Taffy::new(); + let mut taffy: Taffy = Taffy::new(); let child = taffy - .new_leaf_with_measure( + .new_leaf_with_context( Style { position: Position::Absolute, ..Default::default() }, - MeasureFunc::Raw(|known_dimensions, _available_space| Size { - width: known_dimensions.width.unwrap_or(50.0), - height: known_dimensions.height.unwrap_or(50.0), - }), + FixedMeasure { width: 50.0, height: 50.0 }, ) .unwrap(); @@ -420,7 +384,7 @@ mod measure { ) .unwrap(); - taffy.compute_layout(node, Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, Size::MAX_CONTENT, fixed_measure_function).unwrap(); assert_eq!(taffy.layout(child).unwrap().size.width, 50.0); assert_eq!(taffy.layout(child).unwrap().size.height, 50.0); @@ -428,7 +392,7 @@ mod measure { #[test] fn ignore_invalid_measure() { - let mut taffy = Taffy::new(); + let mut taffy: Taffy = Taffy::new(); let child = taffy.new_leaf(Style { flex_grow: 1.0, ..Default::default() }).unwrap(); let node = taffy @@ -441,7 +405,7 @@ mod measure { ) .unwrap(); - taffy.compute_layout(node, Size::MAX_CONTENT).unwrap(); + taffy.compute_layout_with_measure(node, Size::MAX_CONTENT, fixed_measure_function).unwrap(); assert_eq!(taffy.layout(child).unwrap().size.width, 100.0); assert_eq!(taffy.layout(child).unwrap().size.height, 100.0); diff --git a/tests/min_max_overrides.rs b/tests/min_max_overrides.rs index 78f9d893c..cff8553f5 100644 --- a/tests/min_max_overrides.rs +++ b/tests/min_max_overrides.rs @@ -1,11 +1,10 @@ #[cfg(test)] mod min_max_overrides { - use taffy::prelude::*; #[test] fn min_overrides_max() { - let mut taffy = Taffy::new(); + let mut taffy: Taffy<()> = Taffy::new(); let child = taffy .new_leaf(Style { @@ -28,7 +27,7 @@ mod min_max_overrides { #[test] fn max_overrides_size() { - let mut taffy = Taffy::new(); + let mut taffy: Taffy<()> = Taffy::new(); let child = taffy .new_leaf(Style { @@ -50,7 +49,7 @@ mod min_max_overrides { #[test] fn min_overrides_size() { - let mut taffy = Taffy::new(); + let mut taffy: Taffy<()> = Taffy::new(); let child = taffy .new_leaf(Style { diff --git a/tests/relayout.rs b/tests/relayout.rs index 8f5fa9e24..ca7d8642b 100644 --- a/tests/relayout.rs +++ b/tests/relayout.rs @@ -2,7 +2,7 @@ use taffy::prelude::*; #[test] fn relayout() { - let mut taffy = taffy::Taffy::new(); + let mut taffy: Taffy<()> = taffy::Taffy::new(); let node1 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { width: length(8.0), height: length(80.0) }, @@ -29,7 +29,6 @@ fn relayout() { &[node0], ) .unwrap(); - println!("0:"); taffy .compute_layout( node, @@ -39,8 +38,7 @@ fn relayout() { let initial = taffy.layout(node).unwrap().location; let initial0 = taffy.layout(node0).unwrap().location; let initial1 = taffy.layout(node1).unwrap().location; - for i in 1..10 { - println!("\n\n{i}:"); + for _ in 1..10 { taffy .compute_layout( node, @@ -71,7 +69,7 @@ fn toggle_root_display_none() { }; // Setup - let mut taffy = taffy::Taffy::new(); + let mut taffy: Taffy<()> = taffy::Taffy::new(); let node = taffy.new_leaf(hidden_style.clone()).unwrap(); // Layout 1 (None) @@ -105,7 +103,7 @@ fn toggle_root_display_none() { fn toggle_root_display_none_with_children() { use taffy::prelude::*; - let mut taffy = taffy::Taffy::new(); + let mut taffy: Taffy<()> = taffy::Taffy::new(); let child = taffy .new_leaf(Style { size: Size { width: length(800.0), height: length(100.0) }, ..Default::default() }) @@ -151,7 +149,7 @@ fn toggle_flex_child_display_none() { }; // Setup - let mut taffy = taffy::Taffy::new(); + let mut taffy: Taffy<()> = taffy::Taffy::new(); let node = taffy.new_leaf(hidden_style.clone()).unwrap(); let root = taffy.new_with_children(flex_style.clone(), &[node]).unwrap(); @@ -197,7 +195,7 @@ fn toggle_flex_container_display_none() { }; // Setup - let mut taffy = taffy::Taffy::new(); + let mut taffy: Taffy<()> = taffy::Taffy::new(); let node = taffy.new_leaf(hidden_style.clone()).unwrap(); let root = taffy.new_with_children(hidden_style.clone(), &[node]).unwrap(); @@ -243,7 +241,7 @@ fn toggle_grid_child_display_none() { }; // Setup - let mut taffy = taffy::Taffy::new(); + let mut taffy: Taffy<()> = taffy::Taffy::new(); let node = taffy.new_leaf(hidden_style.clone()).unwrap(); let root = taffy.new_with_children(grid_style.clone(), &[node]).unwrap(); @@ -289,7 +287,7 @@ fn toggle_grid_container_display_none() { }; // Setup - let mut taffy = taffy::Taffy::new(); + let mut taffy: Taffy<()> = taffy::Taffy::new(); let node = taffy.new_leaf(hidden_style.clone()).unwrap(); let root = taffy.new_with_children(hidden_style.clone(), &[node]).unwrap(); @@ -322,7 +320,7 @@ fn toggle_grid_container_display_none() { #[test] fn relayout_is_stable_with_rounding() { - let mut taffy = Taffy::new(); + let mut taffy: Taffy<()> = taffy::Taffy::new(); taffy.enable_rounding(); //
@@ -364,7 +362,7 @@ fn relayout_is_stable_with_rounding() { for _ in 0..5 { taffy.mark_dirty(root).ok(); taffy.compute_layout(root, Size::MAX_CONTENT).ok(); - taffy::util::print_tree(&taffy, root); + taffy.print_tree(root); let root_layout = taffy.layout(root).unwrap(); assert_eq!(root_layout.location.x, 0.0); diff --git a/tests/root_constraints.rs b/tests/root_constraints.rs index 9791fd28b..2cd9b4c35 100644 --- a/tests/root_constraints.rs +++ b/tests/root_constraints.rs @@ -1,10 +1,11 @@ #[cfg(test)] mod root_constraints { use taffy::style::AvailableSpace; + use taffy::Taffy; #[test] fn root_with_percentage_size() { - let mut taffy = taffy::Taffy::new(); + let mut taffy: Taffy<()> = Taffy::new(); let node = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -32,7 +33,7 @@ mod root_constraints { #[test] fn root_with_no_size() { - let mut taffy = taffy::Taffy::new(); + let mut taffy: Taffy<()> = Taffy::new(); let node = taffy.new_leaf(taffy::style::Style::default()).unwrap(); taffy @@ -52,7 +53,7 @@ mod root_constraints { #[test] fn root_with_larger_size() { - let mut taffy = taffy::Taffy::new(); + let mut taffy: Taffy<()> = Taffy::new(); let node = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { diff --git a/tests/rounding.rs b/tests/rounding.rs index 3e273afc0..3b1250acc 100644 --- a/tests/rounding.rs +++ b/tests/rounding.rs @@ -3,7 +3,7 @@ use taffy::prelude::*; #[test] fn rounding_doesnt_leave_gaps() { // First create an instance of Taffy - let mut taffy = Taffy::new(); + let mut taffy: Taffy<()> = Taffy::new(); let w_square = Size { width: length(100.3), height: length(100.3) }; let child_a = taffy.new_leaf(Style { size: w_square, ..Default::default() }).unwrap(); @@ -21,9 +21,9 @@ fn rounding_doesnt_leave_gaps() { .unwrap(); taffy.compute_layout(root_node, Size::MAX_CONTENT).unwrap(); + taffy.print_tree(root_node); let layout_a = taffy.layout(child_a).unwrap(); let layout_b = taffy.layout(child_b).unwrap(); - taffy::util::print_tree(&taffy, root_node); assert_eq!(layout_a.location.x + layout_a.size.width, layout_b.location.x); }